TASVideos / tasvideos

The code for the live TASVideos website
https://tasvideos.org/
GNU General Public License v3.0
64 stars 28 forks source link

Disable URL-autolinkification within [url=URL] BBCode tags #793

Closed SandTAS closed 2 years ago

SandTAS commented 2 years ago

The BBCode parser should not auto-link URLs when they are inside [url=URL][/url] tags. Otherwise, you get nested a HTML elements, which is against spec ("there must be no ... a element descendant").

For example, the BBCode

[url=https://outer.example.com/]hello https://inner.example.com/ world[/url]

should become

<a href="https://outer.example.com/">hello https://inner.example.com/ world</a>

not

<a href="https://outer.example.com/">hello <a href="https://inner.example.com/">https://inner.example.com/</a> world</a>

See https://tasvideos.org/Forum/Posts/501179#501179 for an example of where this goes wrong. The old forum did not have URL auto-linkification, so if one wanted a URL that was also a link, one had to do something like [url=URL]URL[/url]. The example in this post is

[url=https://pad.riseup.net/p/u2s2Ko2T7_xD3aBW_N8w]https://pad.riseup.net/p/u2s2Ko2T7_xD3aBW_N8w[/url]

which renders as

<a href="https://pad.riseup.net/p/u2s2Ko2T7_xD3aBW_N8w"><a href="https://pad.riseup.net/p/u2s2Ko2T7_xD3aBW_N8w">https://pad.riseup.net/p/u2s2Ko2T7_xD3aBW_N8w</a></a>
nattthebear commented 2 years ago

The old forum did not have URL auto-linkification

Yes, it did.

nattthebear commented 2 years ago

This also affects explicit urlification, such as


1[url=https://outer.example.com/]A[url=https://inner.example.com/]B[/url]C[/url]2
SandTAS commented 2 years ago

The old forum did not have URL auto-linkification

Yes, it did.

My mistake; I guess you are right. I found https://web.archive.org/web/20170903052220/http://tasvideos.org/forum/viewtopic.php?t=7860#275096 on the old forum that appears to have auto-linked URLs. I don't know why I thought I had to use [url] then.

nattthebear commented 2 years ago

I don't know why I thought I had to use [url] then.

It may have been broken on some inputs, or may have not always existed as a feature in the old system. That code base was Something Special.