From 16fb98e1aa18575e2eb79c6f9890d71e28ede237 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Sat, 23 Jun 2018 23:11:04 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=94=20Check=20for=20only=20full=20files?= =?UTF-8?q?=20in=20release=20from=20-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ssn/getPatch.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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