adm-zip icon indicating copy to clipboard operation
adm-zip copied to clipboard

Error while extracting to a path containing colon

Open AvrahamO opened this issue 3 years ago • 1 comments

When one of the folders in path contains a colon, the method extractAllTo throws

Error: ENOENT: no such file or directory, chmod '/usr/app/path:colon/zipfile/file.json'
    at Object.chmodSync (node:fs:1826:3)
    at Utils.writeFileTo (/usr/app/node_modules/adm-zip/util/utils.js:83:17)
    at /usr/app/node_modules/adm-zip/adm-zip.js:616:27
    at Array.forEach (<anonymous>)
    at Object.extractAllTo (/usr/app/node_modules/adm-zip/adm-zip.js:604:26)
    at [eval]:1:60
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:305:38)
    at node:internal/process/execution:81:19
    at [eval]-wrapper:6:22 {
  errno: -2,
  syscall: 'chmod',
  code: 'ENOENT',
  path: '/usr/app/path:colon/zipfile/file.json'
}

After digging in the code, I saw the following line:

            if (!name || name.substr(-1, 1) === ":") return;

What is the reason for this code?

AvrahamO avatar Dec 15 '21 17:12 AvrahamO

What is the reason for this code?

I believe it should remove "drive letters" under windows. But it needs some further investigation.

5saviahv avatar May 22 '24 18:05 5saviahv