Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mailto: no correctly rendered #47

Open
GoogleCodeExporter opened this issue Apr 26, 2015 · 0 comments
Open

mailto: no correctly rendered #47

GoogleCodeExporter opened this issue Apr 26, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. create some markdown with a link to send an email like 
[mail](email@me.com)
2. call the converter on the string
string = '[mail](mailto:email@me.com)'
converter.makeHtml(string);
3.

What is the expected output? What do you see instead?
The output should be 
<a href="mailto:mail@me.com">mail</a>

instead we have
<a href="{absoluteURL}mailto%3Amail@me.com">mail</a>

What version of the product are you using? On what operating system?


Please provide any additional information below.

This has been fixed by tweaking one of the attackLab functions (below), to 
avoid encoding the ":" when preceeded by "mailto".

function encodeProblemUrlChars(url) {
   if (!url)
     return "";
//if we have an "email:" type of link then do not encode the ":"
   else if (/mailto:/.test(url))
     return url;
   else {
     var len = url.length;
     return url.replace(_problemUrlChars, function (match, offset) {
    if (match == "~D") // escape for dollar
          return "%24";
    if (match == ":") { 
      if (offset == len - 1 || /[0-9\/]/.test(url.charAt(offset + 1)))
        return ":"
    } 
    return "%" + match.charCodeAt(0).toString(16);
     });
  }
}

Original issue reported on code.google.com by dmar...@allscenes.com on 17 Nov 2012 at 1:30

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant