From de2119c06aba3c2d9f7cc5a661eb241b2c8e051a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 12 Jan 2015 10:05:23 -0800 Subject: 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. --- js/lib/common.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'js') 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) { -- cgit v1.2.3