Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

fix: sanitize rollup-generated filenames #1648

Merged
merged 4 commits into from
Nov 3, 2021
Merged

fix: sanitize rollup-generated filenames #1648

merged 4 commits into from
Nov 3, 2021

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Nov 2, 2021

πŸ”— Linked issue

resolves nuxt/nuxt#12606
reverts #477

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR removes characters from rollup filenames that are excluded from valid URLs (see RFC 2396). As rollup-produced files may be consumed by browsers, this is one approach to provide broader ecosystem safety without requiring URL encoding.

I've also proposed this in a PR directly to rollup but there may be legitimate reasons for closing it, as this is relevant specifically to browsers rather than the node ecosystem. If accepted we can remove the implementation in this PR.

(Having said that I have also implemented for nitro as I feel most of these characters may also pose problems for filesystems, and in a worker target the filenames may also become URLs.)

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added bug Something isn't working nitro vite labels Nov 2, 2021
@danielroe danielroe requested a review from pi0 November 2, 2021 15:00
@danielroe danielroe self-assigned this Nov 2, 2021
@netlify
Copy link

netlify bot commented Nov 2, 2021

βœ”οΈ Deploy Preview for nuxt3-docs canceled.

πŸ”¨ Explore the source changes: 17db2f8

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/618286c69b78190007341fed

@pi0
Copy link
Member

pi0 commented Nov 2, 2021

This is a nice idea and we need sanitizers both for generated file names and export identifiers (instead of unreadable hashes we use). What do you think to move sanitizePath to mlly?

@pi0 pi0 marked this pull request as ready for review November 3, 2021 12:55
@pi0 pi0 merged commit d30f4d8 into main Nov 3, 2021
@pi0 pi0 deleted the fix/sanitize-filenames branch November 3, 2021 13:04
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x bug Something isn't working nitro vite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dynamic routes will generate path with unwise character, which may cause problem
2 participants