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

fix: #564 resolves issue with element.replace on non-string elements #567

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

lawren
Copy link
Contributor

@lawren lawren commented Nov 22, 2024

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This PR fixes an issue in the subresourceintegrity.ts file where element.replace was called on non-string elements in the html[section] array. This caused a TypeError: element.replace is not a function in SRI mode when third-party libraries, such as PrimeVue, injected non-string elements.

The change introduces a type check to skip non-string elements, ensuring the rendering process doesn’t break.

Why is this change required?
This resolves a crash in applications using Nuxt Security with SRI and libraries like PrimeVue.

Relates to: #564

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)
    • Tests are not applicable in this case since the change addresses runtime behavior with specific third-party library interactions. I did, however, verify existing tests.

Copy link

vercel bot commented Nov 22, 2024

@lawren is attempting to deploy a commit to the Baroshem's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vejja
Copy link
Collaborator

vejja commented Nov 22, 2024

ok

@vejja vejja merged commit 938e859 into nuxt-modules:main Nov 22, 2024
1 of 2 checks passed
@vejja vejja mentioned this pull request Nov 22, 2024
6 tasks
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

Successfully merging this pull request may close these issues.

2 participants