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

path methods throw an exception if filename contains control chars #1230

Closed
adamesque opened this issue Jun 25, 2011 · 0 comments
Closed

path methods throw an exception if filename contains control chars #1230

adamesque opened this issue Jun 25, 2011 · 0 comments

Comments

@adamesque
Copy link

path methods like path.basename and path.extname break if you pass them a filename that includes (legal) control characters like \r, because the splitPathRe regex uses . to match "any char", which excludes newlines.

Most people are sane enough not to use control chars in filenames, but on OS X, if you give a file or folder a custom icon, the custom icon data is stored in a hidden file called Icon\r.

adamesque added a commit to adamesque/node that referenced this issue Jun 25, 2011
Use [\s\S] instead of . to match any char, including newlines.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants