fix(archive): validate stream file archive paths and throw on premature bzip2 stream termination
This commit is contained in:
@@ -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