aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-03-22 17:44:38 -0400
committerGitHub <noreply@github.com>2018-03-22 17:44:38 -0400
commite26424a74092ba278c7744bbccdbc97a080693cc (patch)
tree6b9bfcbd2565681de4abaa8455fa1e7151008a13 /actionpack/lib
parentba4bdc536b9241a374673a5a0e67feeff3532964 (diff)
parent2ef145883348e92c9e6393ece9b6967e3a5a80c7 (diff)
downloadrails-e26424a74092ba278c7744bbccdbc97a080693cc.tar.gz
rails-e26424a74092ba278c7744bbccdbc97a080693cc.tar.bz2
rails-e26424a74092ba278c7744bbccdbc97a080693cc.zip
Merge pull request #32316 from rails/fix-non-ascii-static-file-serving
Use ASCII-8BIT paths in ActionDispatch::Static
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/middleware/static.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/static.rb b/actionpack/lib/action_dispatch/middleware/static.rb
index 23492e14eb..acd999444a 100644
--- a/actionpack/lib/action_dispatch/middleware/static.rb
+++ b/actionpack/lib/action_dispatch/middleware/static.rb
@@ -16,7 +16,7 @@ module ActionDispatch
# does not exist, a 404 "File not Found" response will be returned.
class FileHandler
def initialize(root, index: "index", headers: {})
- @root = root.chomp("/")
+ @root = root.chomp("/").b
@file_server = ::Rack::File.new(@root, headers)
@index = index
end
@@ -35,7 +35,7 @@ module ActionDispatch
paths = [path, "#{path}#{ext}", "#{path}/#{@index}#{ext}"]
if match = paths.detect { |p|
- path = File.join(@root, p.dup.force_encoding(Encoding::UTF_8))
+ path = File.join(@root, p.b)
begin
File.file?(path) && File.readable?(path)
rescue SystemCallError
@@ -43,7 +43,7 @@ module ActionDispatch
end
}
- return ::Rack::Utils.escape_path(match)
+ return ::Rack::Utils.escape_path(match).b
end
end