diff options
author | sepehr500 <sepehr411@gmail.com> | 2017-05-12 14:43:34 -0400 |
---|---|---|
committer | sepehr500 <sepehr411@gmail.com> | 2017-05-15 20:54:13 -0400 |
commit | bfbbb1207930e7ebe56d4a99abd53b2aa66e0b6e (patch) | |
tree | 7fe7bc813c4a7443b9929d36a12ac92fb4eda0b7 /actionpack/lib/action_dispatch | |
parent | 661f537b15026a35234db8a7b9386b4335198a8a (diff) | |
download | rails-bfbbb1207930e7ebe56d4a99abd53b2aa66e0b6e.tar.gz rails-bfbbb1207930e7ebe56d4a99abd53b2aa66e0b6e.tar.bz2 rails-bfbbb1207930e7ebe56d4a99abd53b2aa66e0b6e.zip |
Fixed string being modified in place causing frozen string errors in Ruby 2.3
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/upload.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb index 61ba052e45..225272d66e 100644 --- a/actionpack/lib/action_dispatch/http/upload.rb +++ b/actionpack/lib/action_dispatch/http/upload.rb @@ -27,14 +27,18 @@ module ActionDispatch @tempfile = hash[:tempfile] raise(ArgumentError, ":tempfile is required") unless @tempfile - @original_filename = hash[:filename] - if @original_filename + if hash[:filename] + @original_filename = hash[:filename].dup + begin @original_filename.encode!(Encoding::UTF_8) rescue EncodingError @original_filename.force_encoding(Encoding::UTF_8) end + else + @original_filename = nil end + @content_type = hash[:type] @headers = hash[:head] end |