6174 / 6174/pagedown

mailto: no correctly rendered

Aberta
#47 0 comentários 0 reações 0 responsáveis Ver no GitHub
auto-migrated Priority-Medium Type-Defect
Linguagem predominante
JavaScript
Estrelas
0
Forks
0
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

```
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
mail

instead we have
mail

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:
- [Markdown.Converter.js](https://storage.googleapis.com/google-code-attachments/pagedown/issue-47/comment-0/Markdown.Converter.js)

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.