The issue involves Onebox incorrectly encoding single quotes (') as ' in URLs, which breaks links—such as in the example https://doomwiki.org/wiki/Musical_inspirations_behind_Doom's_music. While the encoding was originally intended as a preventive measure against XSS, users noted that percent-encoding (%27) works correctly and that HTML entities like ' should not appear in URLs at all. sam suggested following RFC 3986 specs, proposing separate encoding rules for URL paths versus query parameters. lionel-rowe confirmed that percent-encoding works fine, and Dannii pointed out that double-encoding is occurring in the HTML output. techAPJ implemented a fix in commit 7a1885c48800693d9d4abfa9c58d6d25fd19ca65, resolving the issue by aligning encoding behavior with the spec and distinguishing between path and query parameter handling. The fix ensures single quotes in paths are no longer HTML-encoded, preserving valid URLs while maintaining security.
The encoding is done as preventive measure against XSS attacks. I am not sure if we should let single quotes pass through in URL as it is a rare edge case. Thoughts?
We should follow the spec here with our encoding. Technically I think we got to allow stuff like ( and ) through cause wikipedia can use that. Even & is allowed according to spec eg: https://en.wikipedia.org/wiki/&
Works fine (even though ' isn’t percent encoded per the spec). I’m not aware of a situation where HTML entities should be used anywhere in a URL, even in query params.