Simple Machines Community Forum

SMF Development => Bug Reports => Topic started by: Danielㅤ on May 23, 2023, 06:12:40 PM

Title: URL Problem
Post by: Danielㅤ on May 23, 2023, 06:12:40 PM
Hello, the other day giving support to a user I noticed a bug in this new version 2.1 of SMF, the bug occurs when another URL is inserted as a parameter in a URL/link, a clear example is when using web archive, here you can see the error:

https://web.archive.org/web/20190118235245/https://www.simplemachines.org/community/index.php?board=16.0

as you can notice the URL is cut off after the https://.


Greetings
Title: Re: URL Problem
Post by: Kindred on May 23, 2023, 07:54:55 PM
Meh...  a second https is not actually valid in the url under normal circumstances
Title: Re: URL Problem
Post by: Sesquipedalian on May 23, 2023, 09:19:26 PM
Hm. Yes, technically that is a bug.

However, if you look carefully, you'll notice that the detected URL actually ends after the second "https:/", rather than after "https://".

In general, the only place in a URL where two slashes are supposed to occur in a row is right after the scheme declaration. Therefore, SMF's autolinker assumes that if it encounters two slashes anywhere later in the string, it must have already reached the end of the current URL, and so it cuts off at that point.

Unfortunately, fixing this bug might be a bit tricky. Tweaking the relevant code so that it detected this URL correctly would be easy. Tweaking the relevant code in a way that didn't also cause it to do the wrong thing in a whole bunch of other cases will be difficult.

All of which is to say that I will almost certainly try to fix this bug, but that you shouldn't hold your breath waiting for the fix.

In the meantime, you can work around this bug by wrapping such URLs in [url][/url] tags.
Title: Re: URL Problem
Post by: Danielㅤ on May 24, 2023, 09:34:55 AM
Thanks for the answers.

Kindred
Yes, it is true, it is not common for one url to be inside another, however web archive is a website that is often used, in SMF 2.0 there is no such problem with the url.


Sesquipedalian
Thanks for the explanation.
If I figured it was a bug, you're right, the url is cut off after the https:/ in the first forward slash, I hadn't noticed.
I'm glad to know that you're going to fix it at some point  ;D

If I did a test using the url tag and I have noticed that the problem is solved, this way can be used with the web archive urls so that they do not cause the conflict of being cut off.

Thanks again mates! (https://i.postimg.cc/bYknXHS6/image.png)