diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-07-19 17:09:13 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-07-19 17:09:13 -0600 |
commit | f91439d848b305a9d8f83c10905e5012180ffa28 (patch) | |
tree | 45c01f22da71b298dd2ea0ac3811adfb563d4ee5 /actionpack/lib/action_dispatch/middleware/static.rb | |
parent | e19acbb8831e214eb38d589bf8c424edf80c2970 (diff) | |
parent | 5bb1d4d288d019e276335465d0389fd2f5246bfd (diff) | |
download | rails-f91439d848b305a9d8f83c10905e5012180ffa28.tar.gz rails-f91439d848b305a9d8f83c10905e5012180ffa28.tar.bz2 rails-f91439d848b305a9d8f83c10905e5012180ffa28.zip |
Merge pull request #20946 from schneems/schneems/let-it-go
Freeze string literals when not mutated.
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/static.rb')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/static.rb | 6 |
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 b098ea389f..f38da4fdf6 100644 --- a/actionpack/lib/action_dispatch/middleware/static.rb +++ b/actionpack/lib/action_dispatch/middleware/static.rb @@ -35,7 +35,7 @@ module ActionDispatch paths = [path, "#{path}#{ext}", "#{path}/#{@index}#{ext}"] if match = paths.detect { |p| - path = File.join(@root, p.force_encoding('UTF-8')) + path = File.join(@root, p.force_encoding('UTF-8'.freeze)) begin File.file?(path) && File.readable?(path) rescue SystemCallError @@ -76,7 +76,7 @@ module ActionDispatch end def content_type(path) - ::Rack::Mime.mime_type(::File.extname(path), 'text/plain') + ::Rack::Mime.mime_type(::File.extname(path), 'text/plain'.freeze) end def gzip_encoding_accepted?(env) @@ -112,7 +112,7 @@ module ActionDispatch def call(env) case env['REQUEST_METHOD'] when 'GET', 'HEAD' - path = env['PATH_INFO'].chomp('/') + path = env['PATH_INFO'].chomp('/'.freeze) if match = @file_handler.match?(path) env['PATH_INFO'] = match return @file_handler.call(env) |