dcwatson / bbcode

A pure python bbcode parser and formatter.
BSD 2-Clause "Simplified" License
68 stars 17 forks source link

URLs with ampersand seem to break #33

Closed zarmstrong closed 4 years ago

zarmstrong commented 4 years ago

A url with ampersand in the query string seems to break. It appears like the ampersand is stripped by default.

Lanny commented 4 years ago

Can you provide an example of where this is happening? Is it happening with the auto-linking or using the [url] tag?

I tried it out and I'm not seeing the ampersand being removed. I did notice that it's being converted into a html entity when using the url tag but not when auto-linking, although it doesn't seem to make any difference:

$ echo "this is a test http://google.com?foo=bar&baz=42" | ./bbcode.py
this is a test <a rel="nofollow" href="http://google.com?foo=bar&baz=42">http://google.com?foo=bar&baz=42</a><br />
$ echo "this is a test [url]http://google.com?foo=bar&baz=42[/url]" | ./bbcode.py
this is a test <a rel="nofollow" href="http://google.com?foo=bar&amp;baz=42">http://google.com?foo=bar&amp;baz=42</a><br />
zarmstrong commented 4 years ago

Yep you're right. File this under "I didn't trace my code well".