unjs / ipx

🖼️ High performance, secure and easy-to-use image optimizer.
MIT License
1.54k stars 61 forks source link

Filenames with parentheses cause error #56

Closed speker2010 closed 2 years ago

speker2010 commented 2 years ago

If I use images with names containing parentheses, ipx will show an error instead of an image.

example

https://github.com/speker2010/ipx-bug-showcase http://localhost:3000/image/_/foto.jpeg works fine http://localhost:3000/image/_/foto(1).jpeg shows error IPX: Forbidden path:/foto(1).jpeg

speker2010 commented 2 years ago

I've made some investigation. Error appears at https://github.com/unjs/ipx/blob/main/src/sources/filesystem.ts#L13-L15 because of isValidPath from 'is-valid-path' module treats filenames with parentheses as incorrect.