1 parent
b9ffc2860c
commit
e57e2d3400
4 files changed
+15
-1
No files matched your search
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/cafs": patch
|
||||
"pnpm": patch
|
||||
---
|
||||
|
||||
Don't fail when a package is archived in a tarball with malformed tar headers [#5362](https://github.com/pnpm/pnpm/issues/5362).
|
||||
@@ -11,7 +11,7 @@ export async function addFilesFromTarball (
|
||||
manifest?: DeferredManifestPromise
|
||||
): Promise<FilesIndex> {
|
||||
const ignore = _ignore ?? (() => false)
|
||||
const extract = tar.extract()
|
||||
const extract = tar.extract({ allowUnknownFormat: true })
|
||||
const filesIndex: FilesIndex = {}
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
extract.on('entry', (header, fileStream, next) => {
|
||||
|
||||
Binary file not shown.
@@ -74,3 +74,11 @@ test('file names are normalized when unpacking a tarball', async () => {
|
||||
'package.json',
|
||||
])
|
||||
})
|
||||
|
||||
test('broken magic in tarball headers is handled gracefully', async () => {
|
||||
const dest = tempy.directory()
|
||||
const cafs = createCafs(dest)
|
||||
await cafs.addFilesFromTarball(
|
||||
createReadStream(path.join(__dirname, 'fixtures/jquery.dirtyforms-2.0.0.tgz'))
|
||||
)
|
||||
})
|
||||
Reference in new issue
Block a user