DragonByte Tech
Well-known member
- Affected version
- 2.1.0
This is not actually something I can't replicate here @ this site, but I can @ our site and also locally (locally I've tested it with all addons disabled).
I've modified
This is the current value of
The issue can be confirmed on https://regex101.com:
However, if I update the regex to this:
(Important part:
The regex works on the website:
Producing this output:
Which still doesn't work when previewing it. At this point, further attempts at debugging branches off because I don't know what the intended functionality is;
I've modified
\XF\BbCode\ProcessorAction\AutoLink
, mostly inside public function filterString($string, array $options, Processor $processor)
, to give me an idea of the progress of the function:
Code:
String before autoLink: www.test.de?test=test
String after unfurlLinkRegex: [URL="http://www.test.de?test=test"]www.test.de?test=test[/URL]
Parameter passed to autoLinkUrl: www.test.de?test=test[/URL]
String after autoLinkRegex: [URL="http://www.test.de?test=test"][URL="http://www.test.de?test=test[/URL]"]www.test.de?test=test[/URL][/URL]
This is the current value of
$autoLinkRegex
in my copy of the files:
PHP:
$autoLinkRegex = '(?<=[^a-z0-9@/\.-]|^)(?<!\]\(|url=(?:"|\')|url\]|url\sunfurl=(?:"|\')true(?:"|\')\]|img\])(https?://|www\.)[^\s"<>{}`]+';
The issue can be confirmed on https://regex101.com:
However, if I update the regex to this:
PHP:
$autoLinkRegex = '(?<=[^a-z0-9@/\.-]|^)(?<!\]\(|url=(?:"|\')|url\]|url\sunfurl=(?:"|\')true(?:"|\')\]|img\])(https?://|www\.)[^\s"<>{}`\[]+';
\[
before the ]+
bit at the end)The regex works on the website:
Producing this output:
Code:
String before autoLink: www.test.de?test=test
String after unfurlLinkRegex: [URL="http://www.test.de?test=test"]www.test.de?test=test[/URL]
Parameter passed to autoLinkUrl: www.test.de?test=test
String after autoLinkRegex: [URL="http://www.test.de?test=test"][URL="http://www.test.de?test=test"]www.test.de?test=test[/URL][/URL]
Which still doesn't work when previewing it. At this point, further attempts at debugging branches off because I don't know what the intended functionality is;
- Is
public function unfurlLinkUrl($url)
correct, and it should add the surrounding URL tags?
If so, the problem is likely that the$autoLinkRegex
should probably include the URL tags in$match[0]
so the auto linker isn't ran. - Is
public function unfurlLinkUrl($url)
wrong?
If so, the problem is likely thatunfurlLinkUrl
should not add URL tags, instead letting the autoLink function take care of this.