MyBB Community Forums

Full Version: URL incomplete link in a post
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It looks like the ampersand breaks the URL link when it's copy/pasted in a post.
1.8.32

This isn't the way it used to be treated. Is it a mycode problem?

[attachment=45661]
https://community.mybb.com/thread-237311...test=3+456

Seems okay here. Maybe this was posted in the WYSIWYG editor and it's pasted in a partial link.
No. I almost always use Quick Reply, otherwise Source Mode is on in WYSIWYG editor.

I'll have to dig into it. I suspect a Mycode alteration, and a clash of priority.

All Mycodes are disabled -- no change.

Link posts fine here.
https://duckduckgo.com/?t=ffab&q=ampersa...definition

Insert a link works fine there.
Pasted link still parses incomplete.
[attachment=45664]

Results of File Verification.
[attachment=45663]

Using Meld to compare files, all core mods seem valid.
jscripts/bbcodes_sceditor.js simply changes the order of videos in the Insert Video dropdown box.
inc/functions.php is modded by Absolute Time plugin. Deactivating plugin results in not listed in File Verification results.
inc/class_parser.php is modded only to reveal tiny type problem.
[attachment=45665]
I came across this bug a while back, and discovered that it only occurred when HTML is allowed. I don't remember digging deeper than that.

Have just dug deeper. The problem is on line #1693 of inc/class_parser.php. As you can see in the comment on that line, this part of the regex assumes that characters have been encoded, but when HTML is enabled, the call to $this->parse_html($message); on line #192 of that same file is skipped, and thus that assumption is violated, because characters have not been encoded (because it is the parse_html() method that encodes them).
Hey Laird, thanks for that search. I will dig deeper even still when I return in a couple days.
I hope you don't feel miffed that I've deprived you of a bit of debugging fun, but I have a little something for you to try to see whether it fixes the problem (hopefully without unwanted side-effects!). There are other ways to solve this problem, but see what you think of this one:

Change the above-mentioned line #1693 of inc/class_parser.php from:
					(?:/(?:[^\"\s<\[&]|\[\]|&(?:amp|lt|gt);)*)?	# path, query, fragment; exclude unencoded characters
to:
					(?:/(?:[^\"\s<\[&]|\[\]|&(?:amp|lt|gt);|&(?!((amp|lt|gt);)))*)?	# path, query, fragment; handle unencoded ampersands for when HTML is enabled
This part of inc/class_parser.php is now line 1693 in version 1.8.33

I have made the change, and it fixes the mycode_auto_url function when HTML is enabled.
Thanks.
+1
(2023-02-04, 10:25 PM)HLFadmin Wrote: [ -> ]This part of inc/class_parser.php is now line 1693 in version 1.8.33

Oops - typo. Fixed in my post above.

(2023-02-04, 10:25 PM)HLFadmin Wrote: [ -> ]I have made the change, and it fixes the mycode_auto_url function when HTML is enabled.
Thanks.
+1

Great to hear. Thanks for testing and accepting my fix.
Solved the problem here also after update from 1.8.33 to 1.8.34, now on line 1707.