In onebox, `&` become `&`

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.

1 Like

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.

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”

2 Likes

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

&   :arrow_right:   %26

2 Likes

I think we actually fixed this @techAPJ?

1 Like

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

5 Likes