Priority/Severity:
Medium
Platform
OS
Browser
Windows 11
Google Chrome 112.0.5615.138
Ubuntu 22.04
Google Chrome 112.0.5615.49
macOS Ventura
Google Chrome 112.0.5615.137
(all desktop)
Description:
Under the following conditions, BBCode url
tags are not correctly rendered in posts:
Text wrapped in the tags ends in a URL
That URL has a component after the host component (i.e., path , query , and/or fragment )
Reproducible steps:
Make a post that contains the following markup:
[url]http://example.com/[/url]
The markup is not rendered as expected:
Expected behavior:
The markup is rendered as:
Additional context
I am able to reproduce the fault on try.discourse.org in “safe mode ”.
Some additional examples of incorrectly handling of text ending in URL with path:
Markup:
[url]http://example.com/foo[/url]
[url]http://example.com/foo/[/url]
[url=http://example.com/]http://example.com/[/url]
[url=http://example.com/]foo http://example.com/[/url]
Rendered:
Originally reported at Old url markup not migrated to new forum - Website and Forum - Arduino Forum
We have a lot of posts that were written at a time when this markup was correctly rendered (prior to the migration from the SMF framework to Discourse) .
3 إعجابات
sam
(Sam Saffron)
21 أبريل 2023، 6:38ص
2
I have this confirmed as a core bug which we hope to fix over the next few weeks.
Specifically:
[url]http://example.com[/url]
will work however: [url]http://example.com/example[/url]
does not unless you add a trialing space [url]http://example.com/example [/url]
.
I started stepping through stuff and it looks like something is tripping our parser here, possibly an escape rule. We will get this sorted, thanks for raising it.
5 إعجابات
david
(David Taylor)
21 أبريل 2023، 6:54م
7
I’m not super familiar with this code, but I took a quick look. I think it has something to do with the auto-linkify system. By the time the parser goes looking for the close url tag [/url]
, it has already been incorporated into an autolink.
e.g. note that the autolink here is to http://example.com/foo%5B/url%5D
[url]http://example.com/foo[/url]
That’s why adding the space helps - it prevents the autolink from including the [/url]
6 إعجابات
sam
(Sam Saffron)
24 أبريل 2023، 4:45ص
9
I have this fixed per:
discourse:main
← discourse:fix_paths_bbcode
opened 04:31AM - 24 Apr 23 UTC
Due to the order we were parsing markdown, bbcode [url] elements were not
handle… d properly.
`[url]https://example.com/path[/url]` was not currectly parsing cause
linkify was detecting the url as: `https://example.com/path[/url]` which is
legit.
To resolve this I swapped url to use a replace rule, and instead re-parsed
the internal payload and injected the tokens in.
This fix is complex cause we support stuff like
`[url][b]test.com[/b][/url]`
So we need to parse the content inside url `[b]test.com[/b]`
Feel free to review / merge… its a rather complicated fix @per1234 cause we support crazy stuff like
[url][b]www.site.com[/b][/url]
5 إعجابات
sam
(Sam Saffron)
25 أبريل 2023، 8:29م
13
This is all fixed now
[url]http://example.com/foo[/url]
[url]http://example.com/foo/[/url]
[url=http://example.com/]http://example.com/[/url]
[url=http://example.com/]foo http://example.com/[/url]
http://example.com/foo
http://example.com/foo/
http://example.com/
foo http://example.com/
@per1234 you should be already deployed with the fix, let us know if it is all looking good!
Thanks for reporting!
إعجاب واحد (1)
Thanks so much for the commendably speedy resolution sam !
3 إعجابات
sam
(Sam Saffron)
تم إغلاقه في
30 أبريل 2023، 10:00م
15
This topic was automatically closed after 5 days. New replies are no longer allowed.