diff --git a/src/ssn/getPatch.ts b/src/ssn/getPatch.ts index ef7054d..c05ef4a 100644 --- a/src/ssn/getPatch.ts +++ b/src/ssn/getPatch.ts @@ -14,7 +14,13 @@ export default async function getPatch(product: Product, from: number, to: numbe const fileEntries = readSsnFile(zipFile); - //TODO: verify file entries + //Verify file entries + if (from === -1) { + fileEntries.filter((file) => file.diffType !== SsnDiffType.NewFile).forEach((file) => { + throw new Error(`Patches from -1 must be included in full, but this patch had a file "${file.name}" with diff type ${file.diffType}.`); + }); + } + //TODO: last file must always be `${product}.version` with diff type. Other files depend on diffType. console.log(fileEntries); //Extract newly added files