Skip to content

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

Merged
vejja merged 1 commit intoBaroshem:mainfrom
lawren:issue-564
Nov 22, 2024
Merged

fix: #564 resolves issue with element.replace on non-string elements#567
vejja merged 1 commit intoBaroshem:mainfrom
lawren:issue-564

Conversation

@lawren
Copy link
Copy Markdown
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.

@vercel
Copy link
Copy Markdown

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
Copy Markdown
Collaborator

vejja commented Nov 22, 2024

ok

@vejja vejja merged commit 938e859 into Baroshem:main Nov 22, 2024
@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