Discourse encodes characters of fragments in pasted URLs.
E.g.
https://gitpod.io/#https://github.com/eclipse-theia/theia
becomes
https://gitpod.io/#https%3A%2F%2Fgithub.com%2Feclipse-theia%2Ftheia
The issue involves Discourse incorrectly encoding URL fragments (e.g., after #) when pasting links, turning https://gitpod.io/#https://github.com/eclipse-theia/theia into https://gitpod.io/#https%3A%2F%2Fgithub.com%2Feclipse-theia%2Ftheia. svenefftinge first reported this, noting it only affects oneboxed URLs. codinghorror tested and confirmed the behavior. cvx later noted the issue appears fixed in a pull request to the onebox gem, with tests added for the reported URL. However, jankeromnes reported the bug still occurs in Discourse 2.4.0.beta9 when using private messages, specifically with URLs like https://gitpod.io/#snapshot/abcd-1234, which become https://gitpod.io/#snapshot%2Fabcd-1234. j.jaffeux tested in a private message and confirmed it now works — suggesting the fix may have been included in beta10 or later. The issue appears resolved in newer versions, but was persistent in at least beta9.
Discourse encodes characters of fragments in pasted URLs.
E.g.
https://gitpod.io/#https://github.com/eclipse-theia/theia
becomes
https://gitpod.io/#https%3A%2F%2Fgithub.com%2Feclipse-theia%2Ftheia
Ah, there are two links. I didn’t noticed. So, yes, only the link in the box is broken.
This appears to be fixed in DEV: Replace custom uri_encode logic with Addressable by cvx · Pull Request #420 · discourse/onebox · GitHub
I’ve added the reported URL to #uri_encode specs.
Note: This still happens in Discourse version 2.4.0.beta9 (c15d702ae6):
In a Private Message, URLs like https://gitpod.io/#snapshot/abcd-1234 still get wrongly converted to https://gitpod.io/#snapshot%2Fabcd-1234
I notice that Discourse 2.4.0.beta10 is out now – may try to upgrade and see if that helps.
I just tried it in a PM and it worked.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.