istanbuljs / nyc

the Istanbul command line interface
https://istanbul.js.org/
ISC License
5.57k stars 358 forks source link

Sourcemaps with urlencoded chars not loaded #1419

Open kazkansouh opened 3 years ago

kazkansouh commented 3 years ago

Link to bug demonstration repository

I have setup a mini example of the issue:

https://github.com/kazkansouh/nyc-urlencode-bug

Expected Behavior

I expect nyc to correctly handle file paths that contain url encoded characters.

Observed Behavior

$ npx nyc node dist/\{id\}.js
Transformation error for /dev/shm/nyc-urlencode-bug/dist/{id}.js ; return original code
An error occurred while trying to read the map file at /dev/shm/nyc-urlencode-bug/dist/%7Bid%7D.js.map
Error: ENOENT: no such file or directory, open '/dev/shm/nyc-urlencode-bug/dist/%7Bid%7D.js.map'

If I create symlinks from dist/%7Bid%7D.js.map to dist/{id}.js.map nyc runs perfectly ok. I notice that {id}.js contains the url already encoded so perhaps its missing a decode call?

Environment Information

$ npx envinfo@latest --preset nyc

  System:
    OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz
    Memory: 290.67 MB / 15.37 GB
  Binaries:
    Node: 10.19.0 - /usr/bin/node
    npm: 7.20.0 - /usr/local/bin/npm
  npmPackages:
    nyc: ^15.1.0 => 15.1.0 
    typescript: ^4.3.5 => 4.3.5 
mosheeshel commented 9 months ago

Anyone has any ideas here? I have the same issue exactly. Everything else is working (if I don't have such files, it all works fabulously) @kazkansouh did you find a resolution?