From 40f5a3d6f904b6b9558d51b0133f6a406eafc21a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 30 Sep 2014 21:39:57 -0700 Subject: unescape URI before escaping. If we already have %-encoded characters in the URI, we want to preserve them. --- js/stmd.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/stmd.js b/js/stmd.js index 2a63d23..e113794 100755 --- a/js/stmd.js +++ b/js/stmd.js @@ -2333,12 +2333,12 @@ dest = m.slice(1,-1); return [{t: 'Link', label: [{ t: 'Str', c: dest }], - destination: 'mailto:' + encodeURI(dest) }]; + destination: 'mailto:' + encodeURI(unescape(dest)) }]; } else if ((m = this.match(/^<(?:coap|doi|javascript|aaa|aaas|about|acap|cap|cid|crid|data|dav|dict|dns|file|ftp|geo|go|gopher|h323|http|https|iax|icap|im|imap|info|ipp|iris|iris.beep|iris.xpc|iris.xpcs|iris.lwz|ldap|mailto|mid|msrp|msrps|mtqp|mupdate|news|nfs|ni|nih|nntp|opaquelocktoken|pop|pres|rtsp|service|session|shttp|sieve|sip|sips|sms|snmp|soap.beep|soap.beeps|tag|tel|telnet|tftp|thismessage|tn3270|tip|tv|urn|vemmi|ws|wss|xcon|xcon-userid|xmlrpc.beep|xmlrpc.beeps|xmpp|z39.50r|z39.50s|adiumxtra|afp|afs|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|chrome|chrome-extension|com-eventbrite-attendee|content|cvs|dlna-playsingle|dlna-playcontainer|dtn|dvb|ed2k|facetime|feed|finger|fish|gg|git|gizmoproject|gtalk|hcp|icon|ipn|irc|irc6|ircs|itms|jar|jms|keyparc|lastfm|ldaps|magnet|maps|market|message|mms|ms-help|msnim|mumble|mvn|notes|oid|palm|paparazzi|platform|proxy|psyc|query|res|resource|rmi|rsync|rtmp|secondlife|sftp|sgn|skype|smb|soldat|spotify|ssh|steam|svn|teamspeak|things|udp|unreal|ut2004|ventrilo|view-source|webcal|wtai|wyciwyg|xfire|xri|ymsgr):[^<>\x00-\x20]*>/i))) { dest = m.slice(1,-1); return [{ t: 'Link', label: [{ t: 'Str', c: dest }], - destination: encodeURI(dest) }]; + destination: encodeURI(unescape(dest)) }]; } else { return null; } @@ -2615,11 +2615,11 @@ var parseLinkDestination = function() { var res = this.match(reLinkDestinationBraces); if (res) { // chop off surrounding <..>: - return encodeURI(unescapeBS(res.substr(1, res.length - 2))); + return encodeURI(unescape(unescapeBS(res.substr(1, res.length - 2)))); } else { res = this.match(reLinkDestination); if (res !== null) { - return encodeURI(unescapeBS(res)); + return encodeURI(unescape(unescapeBS(res))); } else { return null; } -- cgit v1.2.3