skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

Packages using a hash in paths are broken #311

Open LachlanArthur opened 2 years ago

LachlanArthur commented 2 years ago

Some packages have files/folders that contain the hash character #. Skypack is not encoding this character, so the URLs become invalid (the rest of the URL becomes a hash fragment which is not sent to the server).

An example with an invalid import: https://cdn.skypack.dev/-/d@v1.0.1-7VxaZKsQAIdQpKdn2BTV/dist=es2019,mode=imports/optimized/d.js

The invalid URL in question: https://cdn.skypack.dev/-/es5-ext@v0.10.53-gfFyFZARIEOJ5QNTHY86/dist=es2019,mode=imports/unoptimized/string/#/contains/index.js

Encoding the hash works: https://cdn.skypack.dev/-/es5-ext@v0.10.53-gfFyFZARIEOJ5QNTHY86/dist=es2019,mode=imports/unoptimized/string/%23/contains/index.js