fix(archive): validate stream file archive paths and throw on premature bzip2 stream termination

This commit is contained in:
2026-04-30 13:13:49 +00:00
parent c75c358dfd
commit 1553dc67ef
10 changed files with 4254 additions and 4627 deletions
+5 -1
View File
@@ -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;