From 0e918643ce839ee86b6fdd94f2f7e6866c44fa91 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 5 Jan 2024 17:46:04 +0100 Subject: [PATCH] Check if a blob exists before creating the activity file --- lib/storage/blob.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/storage/blob.js b/lib/storage/blob.js index 172af2e1a..b029b95c5 100644 --- a/lib/storage/blob.js +++ b/lib/storage/blob.js @@ -153,8 +153,12 @@ var clearActivity = function (Env, blobId, cb) { }; var updateActivity = function (Env, blobId, cb) { var path = makeActivityPath(Env, blobId); - var s_data = String(+new Date()); - Fs.writeFile(path, s_data, cb); + var blobPath = makeBlobPath(Env, blobId); + isFile(blobPath, (err, state) => { + if (err || !state) { return void cb(); } + var s_data = String(+new Date()); + Fs.writeFile(path, s_data, cb); + }); }; var archiveActivity = function (Env, blobId, cb) {