fix(archive): validate stream file archive paths and throw on premature bzip2 stream termination
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartarchive',
|
||||
version: '5.2.0',
|
||||
version: '5.2.2',
|
||||
description: 'A library for working with archive files, providing utilities for compressing and decompressing data.'
|
||||
}
|
||||
|
||||
@@ -224,8 +224,12 @@ export class SmartArchive {
|
||||
public addStreamFile(fileArg: plugins.smartfile.StreamFile, archivePath?: string): this {
|
||||
this.ensureNotInExtractMode('addStreamFile');
|
||||
if (!this._mode) this._mode = 'create';
|
||||
const resolvedArchivePath = archivePath ?? fileArg.relativeFilePath;
|
||||
if (!resolvedArchivePath) {
|
||||
throw new Error('StreamFile requires an archivePath when no relativeFilePath is set');
|
||||
}
|
||||
this.pendingEntries.push({
|
||||
archivePath: archivePath || fileArg.relativeFilePath,
|
||||
archivePath: resolvedArchivePath,
|
||||
content: fileArg,
|
||||
});
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user