Please sign in to comment.
Fix Encoding::CompatibilityError when public path is UTF-8
In #5337 we forced the path encoding to ASCII-8BIT to prevent static file handling from blowing up before an application has had chance to deal with possibly invalid urls. However this has a negative side effect of making it an incompatible encoding if the application's public path has UTF-8 characters in it. To work around the problem we check to see if the path has a valid encoding once it has been unescaped. If it is not valid then we can return early since it will not match any file anyway. Fixes #13518 (cherry picked from commit 436ed51)
- Loading branch information...
Showing with 41 additions and 6 deletions.
- +15 −0 actionpack/CHANGELOG.md
- +3 −3 actionpack/lib/action_dispatch/middleware/static.rb
- +16 −3 actionpack/test/dispatch/static_test.rb
- +1 −0 actionpack/test/fixtures/公共/foo/bar.html
- +3 −0 actionpack/test/fixtures/公共/foo/baz.css
- +1 −0 actionpack/test/fixtures/公共/foo/index.html
- +1 −0 actionpack/test/fixtures/公共/foo/こんにちは.html
- +1 −0 actionpack/test/fixtures/公共/index.html