Fix issues with bogus % encoded sequences in URLs

Add a URI sanitizer to the rack stack avoid rack throwing
exceptions on the server side, and ignore errors decoding
components on the client side.

Fixes #1101
This commit is contained in:
Tom Hughes 2015-12-07 13:52:20 +00:00
parent d218d5bf7d
commit e20bb507f1
4 changed files with 25 additions and 11 deletions

View file

@ -53,7 +53,12 @@ OSM = {
j = pair.indexOf('='),
key = pair.slice(0, j),
val = pair.slice(++j);
params[key] = decodeURIComponent(val);
try {
params[key] = decodeURIComponent(val);
} catch (e) {
// Ignore parse exceptions
}
}
return params;