aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-09-29 22:46:52 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2014-09-29 23:00:41 -0700
commit5e6a28c965d6b036b413500a070059585ddfdbe9 (patch)
tree14c3ed90c452d2facd309aaf44ba304d80a56b7f
parentd9f7581443bd786e7d17532f6678efd2ee77c26f (diff)
Escape URIs.
-rwxr-xr-xjs/stmd.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/js/stmd.js b/js/stmd.js
index b9ce5ee..30eceb2 100755
--- a/js/stmd.js
+++ b/js/stmd.js
@@ -207,12 +207,12 @@
dest = m.slice(1,-1);
return [{t: 'Link',
label: [{ t: 'Str', c: dest }],
- destination: 'mailto:' + dest }];
+ destination: 'mailto:' + encodeURI(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: dest }];
+ destination: encodeURI(dest) }];
} else {
return null;
}
@@ -489,11 +489,11 @@
var parseLinkDestination = function() {
var res = this.match(reLinkDestinationBraces);
if (res) { // chop off surrounding <..>:
- return unescape(res.substr(1, res.length - 2));
+ return encodeURI(unescape(res.substr(1, res.length - 2)));
} else {
res = this.match(reLinkDestination);
if (res !== null) {
- return unescape(res);
+ return encodeURI(unescape(res));
} else {
return null;
}