Closed peterhirn closed 1 year ago
The problem is lib/util/glob.js
https://www.npmjs.com/package/glob#windows
The pattern
argument is cache\*(content-*|index-*)
on windows, cache/*(content-*|index-*)
on linux.
Maybe globify
should be something like this
const globify = (pattern) => pattern.replace(/\\+|\/{2,}/g, '/')
But I really don't understand why double forward slashes are replaced at all.
I'm having an issue where the stats
from cacache.verify
are not properly reported on Windows because the files are not detected.
The root of the problem is the same: globify
function is not replacing to forward-slashes as glob
library is expecting to handle Windows paths.
I found that before globify
was at lib/verify.js
, the replacement of the forward-slashes was made correctly.
const globify = pattern => pattern.split('\\').join('/')
But when created the file lib/util/glob.js
and moved globify
there, it was changed to
const globify = pattern => pattern.split('//').join('/')
which is causing problems when glob
is used for obtaining stats and cleanup in the case of verify
Thank you @supita https://github.com/npm/cacache/pull/209
Is there an existing issue for this?
Current Behavior
node:19.6.0-alpine
Output
After
rm.all
cache keys still exist and nothing is delete from the filesystem.Expected Behavior
Exception:
NotFoundError: No cache entry for test-key found in ./cache
Works as expected in version 16.1.3
Steps To Reproduce
No response
Environment