From 23b1074aa2ceb032601fcbdc8ac64a3fdfd730f6 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Thu, 7 Dec 2023 18:09:12 +0100 Subject: [PATCH] cleanup tmp files after import --- server/import.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/import.mjs b/server/import.mjs index 6643cd7..1701b14 100644 --- a/server/import.mjs +++ b/server/import.mjs @@ -108,12 +108,11 @@ async function doImport (owner, repo, id) { } catch (e) { progress[id].output += `Error: ${e.toString()}\n${e.stack}` } finally { - // if (artifactId) { - // // fs.rmSync(`tmp/artifact_${artifactId}.zip`, {force: true, recursive: true}); - // // fs.rmSync(`tmp/artifact_${artifactId}`, {force: true, recursive: true}); - // // fs.rmSync(`tmp/artifact_${artifactId}_inner`, {force: true, recursive: true}); - // // fs.rmSync(`tmp/archive_${artifactId}.tar`, {force: true, recursive: true}); - // } + // clean-up temp. files + if (artifactId) { + fs.rmSync(`${__dirname}/../games/tmp/${owner}_${repo}_${artifactId}.zip`, {force: true, recursive: false}); + fs.rmSync(`${__dirname}/../games/tmp/${owner}_${repo}_${artifactId}`, {force: true, recursive: true}); + } progress[id].done = true } await new Promise(resolve => setTimeout(resolve, 10000))