From b277d81aa1991820a3580e3ee222207aa9a9ad87 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 16 Nov 2018 17:34:57 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=8E=20Do=20not=20delete=20partial=20pa?= =?UTF-8?q?tch=20files=20from=20previous=20runs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cdn/funcs/checkLocalCache.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/cdn/funcs/checkLocalCache.ts b/src/cdn/funcs/checkLocalCache.ts index e1590e5..b90ab67 100644 --- a/src/cdn/funcs/checkLocalCache.ts +++ b/src/cdn/funcs/checkLocalCache.ts @@ -11,13 +11,18 @@ export default function checkLocalCache(fileName: string, size: number): Promise if (fileStats.size === size) { resolve(true); } else { - //delete file so we can overwrite it - fs.unlink(fileName, function(error) { - if (error) { - reject(error); - } + //TODO: use checksum to verify that file is correct + if (true) { resolve(false); - }); + } else { + //file is incorrect; delete it so we can overwrite it + fs.unlink(fileName, function(error) { + if (error) { + reject(error); + } + resolve(false); + }); + } } } else { resolve(false);