summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-12 10:05:23 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-12 10:05:23 -0800
commitde2119c06aba3c2d9f7cc5a661eb241b2c8e051a (patch)
tree395d7f9ec9261b05fae0c9ba56c2bd0510b5d470
parentb7eb63c8be719a43c9aba48484648f375e376c53 (diff)
Wrap decodeURI in a try.
This ensures that we return original content (unnormalized) rather than raising an exception for things like [foo](<&#x25;test>) Not sure if this is the best approach.
-rw-r--r--js/lib/common.js7
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) {