In onebox, `&` become `&`

AI-generated summary

The discussion revolves around the issue of & becoming & in oneboxed URLs when using the Discourse Affiliate plugin. CamilleRoux reported this issue, and Mittineague explained that this is not a bug, but rather a correct format to ensure the URL is valid.

CamilleRoux argues that using & instead of & is more readable, but Mittineague disagrees, stating that the URL is being shown in the correct format. CamilleRoux shared an example of the issue, and Mittineague suggested that the problem might be related to the Discourse app rather than the oneboxed URL.

CamilleRoux pointed out that the URL contains & instead of &, which Mittineague attributed to the ampersand being an entity itself. elijah suggested using URL-encoded ampersands (%26) as a solution.

Codinghorror mentioned that this issue was previously fixed, and techAPJ confirmed that the issue was fixed in December 2017, with an even better and more stable fix in place.

I’m using the Discourse Affiliate plugin to add some params to URL. When the URL is used in plain text or in a link, everything is ok. But when it’s transformed in onebox, the & become &

Do you know why?

So the URL will be valid?

This is usually a cascading error caused by a an undefined entity reference or use of an unencoded ampersand (&) in an URL or body text.

Whatever, it’s more readable if & are used instead of & I think…

Is it a Onebox bug ?

To me it isn’t a bug at all. The URL is being shown in the correct format.

When I click on it it’s still https://www.captaincontrat.com/articles-financement-societe/etapes-convention-actionnaires?utm_source=pragmatic&utm_medium=referral&utm_content=link in the browser (exemple here

That URL works for me.

https://www.captaincontrat.com/articles-financement-societe/etapes-convention-actionnaires?utm_source=pragmatic&utm_medium=referral&utm_content=link

The example “here” link however opens the Discourse app.

I have a feeling this topic is more about the app than oneboxed?

We can see & instead of & in the URL now…

Yes, it can be confusing. Maybe you’ve had coding experience where backslash escapes needed to be backslash escaped themselves?

This is similar. Because the ampersand that signals the beginning of an entity is an entity itself, it “doubles up”

Maybe you should URL encode the ampersands in a URL context?

&   :arrow_right:   %26

I think we actually fixed this @techAPJ?

Yes, this issue was fixed back in December 2017 via this commit… but we now have a much better and stable fix in place:

https://github.com/discourse/onebox/commit/7a1885c48800693d9d4abfa9c58d6d25fd19ca65