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

Fails to resolve file containing spaces on Windows #8

Closed
diegovilar opened this issue Mar 29, 2017 · 1 comment
Closed

Fails to resolve file containing spaces on Windows #8

diegovilar opened this issue Mar 29, 2017 · 1 comment

Comments

@diegovilar
Copy link

Hello!

A third party library I use was failing to find the original sourcemaps of some transpiled JavaScripts, and I managed to map to problem to how resolveUrl translates file paths containing spaces (and perhaps other special chars too).

After going through resolveUrl() in resolve-url.js, a path like /dev/Test Folder/service.js.map will be translated to /dev/Test%20Folder/service.js.map, which in turn will make resolve() in source-map-resolve-node.js fail to locate the file, throwing an ENOENT: no such file or directory, open .... error.

This was tested on Windows. I don't know if the problem occurs on other platforms, but it probably does, because it seams fs.readFile (which is the read function passed to resolve() by the third party library) doesn't work with url encoded paths.

Now, I'm not sure if this is an oversight of the third party library (passing fs.readFile directly instead of a proxy to do some kind of path normalization), or if such normalization shouldn't be done directly by your library.

What do you think?

@lydell
Copy link
Owner

lydell commented Mar 30, 2017

Nice find!

I guess paths shouldn't be URL escaped in the Node.js version. Do you want to make a PR?

Disclaimer: This package is a bit old and so a bit unpleasant to work with sometimes :)

@lydell lydell closed this as completed in 14afeaf Oct 21, 2017
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