i don’t know if this is an issue regarding Discourse exactly or if it’s coming from twitter API but I wanted to share this little bug, when we share a tweet from a account that has a underscore in its username, the link is broken on Discourse, here is an example :
Then it’s something @sam will have to add to his list for later. In the meantime, replace the underscore with the URL-encoded version of the character.
It’s possible to fix, but not easy. Workaround available.
Correct solution is to make linkifier part of tokenizer process. That’s expensive (for example, email lookahead check for every character). Tradeoff is to listen : then do look behind for http(s), and lookahead for the rest. That’s not universal, but will cover all real cases:
http/https links will be parsed with other tokens, with higher priority than emphasis
everything else will be detected via text scan & regexps (as linkifier works now), probability of collision is very low.
I have no plans to do this, but if anyone wish to implement - see explanation above. Or use < >
Pourrions-nous résoudre ce problème en effectuant le travail dans notre gestionnaire de collage, et si nous collons une URL, encoder en pourcentage les tirets bas dans la chaîne de requête ?
Je ne suis pas d’accord ; https:// est un ensemble de caractères tellement rare que je pense que manipuler est généralement assez sûr.
(Sauf dans les blocs de code, il y a donc ceci, mais si le presse-papiers n’est QU’UNE URL, alors c’est tout à fait sûr selon moi. Donc si vous faisiez une ancre de “commence par https://”, je peux garantir à 99,99 % que ce sera sûr.)