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

tag.innerHTML.replace is not a function #278

Closed
kilobyte2007 opened this issue Nov 21, 2023 · 2 comments
Closed

tag.innerHTML.replace is not a function #278

kilobyte2007 opened this issue Nov 21, 2023 · 2 comments

Comments

@kilobyte2007
Copy link

kilobyte2007 commented Nov 21, 2023

Environment

Nuxt 3.8.2, Node v18, MacOS

Reproduction

I think the issue is pretty straightforward, but I will try to create a reproduction if it's not clear enough.

Describe the bug

For some reason, nuxt is generating a style tag with innerHTML: true and not a string, so unhead crashes when running the XSS plugin. This causes the whole app to crash with tag.innerHTML.replace is not a function.

When debugging, here's what the tag that the XSS plugin tries to process sometimes looks like:

{
  tag: 'style',
  props: { 'data-hid': '1e484d8' },
  innerHTML: true,
  _e: 11,
  _p: 11268,
  key: 'island-style-QCbg7GUfFJ',
  _d: 'style:island-style-QCbg7GUfFJ',
  _h: '1e484d8'
}
{ tag: 'style', props: {}, innerHTML: true, _e: 1, _p: 1024 }

Probably a better check is needed here - https://github.com/unjs/unhead/blob/main/packages/unhead/src/plugins/xss.ts

Additional context

No response

Logs

No response

@harlan-zw
Copy link
Collaborator

Thanks for the issue, this is fixed in 1.8.7.

I've gone into more detail of the issue here if you're interested nuxt-modules/fontaine#350.

@kilobyte2007
Copy link
Author

Thanks so much @harlan-zw!
I wouldn't have thought it was fontaine causing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants