Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

& encoding with server rendered strings affects head URLs with multiple params #9695

Closed
1 task done
alexnguyennz opened this issue Jan 14, 2024 · 4 comments · Fixed by #9820
Closed
1 task done

& encoding with server rendered strings affects head URLs with multiple params #9695

alexnguyennz opened this issue Jan 14, 2024 · 4 comments · Fixed by #9820
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)

Comments

@alexnguyennz
Copy link
Contributor

alexnguyennz commented Jan 14, 2024

Astro Info

Astro                    v4.1.2
Node                     v20.9.0
System                   Windows (x64)
Package Manager          unknown
Output                   static
Adapter                  none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Seems intentional but when strings with & are used in a meta head tag, they're encoded as & during development and build which affects URLs with a query string with multiple search params e.g. an og:image link pointing to an API that dynamically generates the image with a title and description.

<meta  
  name="og:image"  
  content={'https://example.com/api/og?title=hello&description=somedescription'}  
/>

<!-- <meta name="og:image" content="https://example.com/api/og?title=hello&#38;description=somedescription"> --> 
<!-- title=hello -->

For the Stackblitz example, when built, it is transformed into &#38; .

What's the expected result?

Not escaped in this case?

<meta  
  name="og:image"  
  content={'https://example.com/api/og?title=hello&description=somedescription'}  
/>

<!-- <meta name="og:image" content="https://example.com/api/og?title=hello&description=somedescription"> --> 
<!-- title=hello description=somedescription -->

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-2f3s26?file=src%2Flayouts%2FLayout.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 14, 2024
@florian-lefebvre
Copy link
Member

I can confirm this, I had the issue in a project of mine and added // TODO: fix in Astro (but never even reported 😂)

@florian-lefebvre florian-lefebvre added - P3: minor bug An edge case that only affects very specific usage (priority) and removed needs triage Issue needs to be triaged labels Jan 24, 2024
@alexnguyennz
Copy link
Contributor Author

Thanks Florian, should I make a PR?

@florian-lefebvre
Copy link
Member

Sure! Feel free to join the discord (in #dev) if you need more guidance

@alexnguyennz
Copy link
Contributor Author

I've made it here: #9820

@florian-lefebvre florian-lefebvre linked a pull request Jan 25, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants