From 436ed5171199ae1764ce413044dad8d1556b7791 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sun, 29 Dec 2013 18:24:02 +0000 Subject: 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 --- "actionpack/test/fixtures/\345\205\254\345\205\261/foo/bar.html" | 1 + "actionpack/test/fixtures/\345\205\254\345\205\261/foo/baz.css" | 3 +++ "actionpack/test/fixtures/\345\205\254\345\205\261/foo/index.html" | 1 + .../\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.html" | 1 + "actionpack/test/fixtures/\345\205\254\345\205\261/index.html" | 1 + 5 files changed, 7 insertions(+) create mode 100644 "actionpack/test/fixtures/\345\205\254\345\205\261/foo/bar.html" create mode 100644 "actionpack/test/fixtures/\345\205\254\345\205\261/foo/baz.css" create mode 100644 "actionpack/test/fixtures/\345\205\254\345\205\261/foo/index.html" create mode 100644 "actionpack/test/fixtures/\345\205\254\345\205\261/foo/\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.html" create mode 100644 "actionpack/test/fixtures/\345\205\254\345\205\261/index.html" (limited to 'actionpack/test/fixtures') diff --git "a/actionpack/test/fixtures/\345\205\254\345\205\261/foo/bar.html" "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/bar.html" new file mode 100644 index 0000000000..9a35646205 --- /dev/null +++ "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/bar.html" @@ -0,0 +1 @@ +/foo/bar.html \ No newline at end of file diff --git "a/actionpack/test/fixtures/\345\205\254\345\205\261/foo/baz.css" "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/baz.css" new file mode 100644 index 0000000000..b5173fbef2 --- /dev/null +++ "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/baz.css" @@ -0,0 +1,3 @@ +body { +background: #000; +} diff --git "a/actionpack/test/fixtures/\345\205\254\345\205\261/foo/index.html" "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/index.html" new file mode 100644 index 0000000000..497a2e898f --- /dev/null +++ "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/index.html" @@ -0,0 +1 @@ +/foo/index.html \ No newline at end of file diff --git "a/actionpack/test/fixtures/\345\205\254\345\205\261/foo/\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.html" "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.html" new file mode 100644 index 0000000000..1df9166522 --- /dev/null +++ "b/actionpack/test/fixtures/\345\205\254\345\205\261/foo/\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257.html" @@ -0,0 +1 @@ +means hello in Japanese diff --git "a/actionpack/test/fixtures/\345\205\254\345\205\261/index.html" "b/actionpack/test/fixtures/\345\205\254\345\205\261/index.html" new file mode 100644 index 0000000000..525950ba6b --- /dev/null +++ "b/actionpack/test/fixtures/\345\205\254\345\205\261/index.html" @@ -0,0 +1 @@ +/index.html \ No newline at end of file -- cgit v1.2.3