diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-12 10:05:23 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-12 10:05:23 -0800 |
commit | de2119c06aba3c2d9f7cc5a661eb241b2c8e051a (patch) | |
tree | 395d7f9ec9261b05fae0c9ba56c2bd0510b5d470 /js/lib | |
parent | b7eb63c8be719a43c9aba48484648f375e376c53 (diff) |
Wrap decodeURI in a try.
This ensures that we return original content (unnormalized) rather
than raising an exception for things like
[foo](<%test>)
Not sure if this is the best approach.
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/common.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/js/lib/common.js b/js/lib/common.js index 6481c68..c365e53 100644 --- a/js/lib/common.js +++ b/js/lib/common.js @@ -34,7 +34,12 @@ var unescapeString = function(s) { }; var normalizeURI = function(uri) { - return encodeURI(decodeURI(uri)); + try { + return encodeURI(decodeURI(uri)); + } + catch(err) { + return uri; + } }; var replaceUnsafeChar = function(s) { |