lib/apipie/static_dispatcher.rb in apipie-rails-0.6.0 vs lib/apipie/static_dispatcher.rb in apipie-rails-0.7.0
- old
+ new
@@ -7,10 +7,12 @@
@file_server = ::Rack::File.new(@root)
end
def match?(path)
# Replace all null bytes
- path = ::Rack::Utils.unescape(path || '').gsub(/\x0/, '')
+ path = ::Rack::Utils.unescape(path || '')
+ .encode(Encoding::UTF_8, invalid: :replace, replace: '')
+ .gsub(/\x0/, '')
full_path = path.empty? ? @root : File.join(@root, path)
paths = "#{full_path}#{ext}"
matches = Dir[paths]