Skip to content

Conversation

@nathan-knight
Copy link

Vite 5 started automatically inlining small SVG files, attempting to request these with AJAX causes CSP issues, after some digging it seemed the most expedient solution was to adjust the request logic so it will avoid making a request if it is given a data URL with the correct MIME type and return the expected structure so it can be used immediately.

I haven't added new tests but I have tested this change and it resolved the issue. This isn't entirely comprehensive, there are additional cases I didn't account for like base64 encoding. If that is needed I can add it as well or this can be used as a starting point.

Relevant commit from Vite: vitejs/vite@5acda5e

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.

1 participant