cmark

My personal build of CMark ✏️

Commit
de2119c06aba3c2d9f7cc5a661eb241b2c8e051a
Parent
b7eb63c8be719a43c9aba48484648f375e376c53
Author
John MacFarlane <jgm@berkeley.edu>
Date

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.

Diffstat

1 file changed, 6 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified js/lib/common.js 7 6 1
diff --git 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) {