Whenever URL’s with special characters, like spaces, are pasted into a Discourse message, they are being rewritten, but the wrong way: spaces become %2520, because somehow the % gets encoded. It’s also strange because when hovering with the mouse over such a URL, the %25 is invisible.
See this link, which I copied verbatim: https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux becomes https://openzfs.github.io/openzfs-docs/Project%2520and%2520Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux.
Don’t mind the actual destination, it’s just the example I currently stumbled upon. Discourse seems to fail at recognizing the already encoded % escapes.
A workaround is to use HTML tags instead:
<a href="https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux">URL text</a>
Another one, courtesy of @g-schick; don’t use the editor button and write the markdown by hand:
[URL text](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux)
1 Like
Moved to SIte Feeback.
That particular link gives me a 404.
Do you have some other examples to share that we can test?
Thanks
1 Like
That’s the point, the 404 is caused by discourse encoding the % of %20 (space) to %25 for a total of %2520. The raw URL copied from Firefox’s location bar is:
https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux
I copied your link from the previous post, pasted it and saved and seemingly no issue?
I’m on Ubuntu 24.04.4 LTS with Firefox 149.0.2 and I too cant’t reproduce the encoding problem.
While that may work with raw URLs on a single line, it’s not the same as [link](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux)
Using the ‘Insert Link’ from discourse seems to encode the link on it’s own. If the link is already encoded the ‘%’ get’s encoded again …
1 Like
FWIW, Firefox just translates %20 and friends on the fly for display purposes, so the encoding has always been there, but somehow discourse fails to recognize that, unless one also encloses the link in quotes, just like with <a href="<URL">; but, again, that’s kind of non-obvious for a dedicated field that already expects valid URL’s.
Let me follow up over at Meta and find out if this is a known issue/limitation.
Thanks for sharing and reporting.
No, like this [link]("<URL>")
Yes, sorry, was fiddling around 
All good, no worries. 
Thanks for looking into it.
Oh, I spoke too soon. Enclosing in quotes does not solve anything, because it renders the markdown URL invalid. I just got confused and missed that I did my changes on another link.
Yes, I’ve just confirmed that one needs to undo the %25 manually. 
Well, this is interesting.
A search over at Meta shows this was an issue that had seemingly been resolved in the past.
I posted a new topic and am eagerly waiting to see the responses.
Stay tuned, this could get exciting!
1 Like
In case you missed it, enclosing in quotes doesn’t solve it. I had my wires crossed. I’ve updated my initial post to show a workaround with plain old html tags.
1 Like
Another option is to create the discourse syntax manually (no url encoding!):
[URL text](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/FAQ.html#using-a-zvol-for-a-swap-device-on-linux)
1 Like
You mean by manually editing the markdown without using the button?
Indeed, that works too, so I’ve added that one to my initial post. Thanks!
1 Like
I have to tell you I love the team over at Meta.
They always respond quickly and with great information.
So…they are not able to reproduce this issue with that URL.
I did a test over at try.discourse.org which has the very latest and greatest version and the issue does not replicate there either.
Therefore, their recommendation is to upgrade our Discourse instance to the latest version.
I will ping the site admins to look into the matter.
Thanks everyone for participating in this interesting little experiment.
1 Like