fix: don't use colon in path to dependency

This commit is contained in:
Zoltan Kochan
2021-02-20 01:04:57 +02:00
parent a97a23e6ac
commit e4efddbd22
3 changed files with 7 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"dependency-path": patch
---
Don't use ":" in path to dependency.

View File

@@ -148,5 +148,5 @@ function depPathToFilenameUnescaped (depPath: string, lockfileDir: string) {
}
const absolutePath = normalize(path.join(lockfileDir, depPath.slice(5)))
return `local#${absolutePath}`
return `local#${absolutePath.replace(':', '#')}`
}

View File

@@ -125,6 +125,7 @@ test('depPathToFilename()', () => {
const filename = depPathToFilename('file:./test/foo-1.0.0.tgz_foo@2.0.0', process.cwd())
expect(filename).toMatch(/^local#.*#foo-1\.0\.0\.tgz_foo@2\.0\.0$/)
expect(filename).not.toContain(':')
expect(depPathToFilename('abcd/'.repeat(200), process.cwd())).toBe('abcd#abcd#abcd#abcd#abcd#abcd#abcd#abcd#abcd#abcd#_36cae148b21d1f0b46577e42f8f4dbae')
})