From 092088cc698cbcdaad7e30eb9a427072d251ed45 Mon Sep 17 00:00:00 2001 From: David Bosschaert Date: Wed, 4 Dec 2024 16:40:27 +0100 Subject: [PATCH] Don't store version on delete --- src/storage/object/delete.js | 11 ++++++----- test/storage/object/delete.test.js | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/storage/object/delete.js b/src/storage/object/delete.js index 2c3e5e6..bc69f92 100644 --- a/src/storage/object/delete.js +++ b/src/storage/object/delete.js @@ -27,12 +27,13 @@ async function invalidateCollab(api, url, env) { } export async function deleteObject(client, daCtx, Key, env, isMove = false) { - const fname = Key.split('/').pop(); + // const fname = Key.split('/').pop(); - if (fname.includes('.') && !fname.startsWith('.') && !fname.endsWith('.props')) { - const tmpCtx = { ...daCtx, key: Key }; // For next calls, ctx needs the passed - await postObjectVersionWithLabel(isMove ? 'Moved' : 'Deleted', env, tmpCtx); - } + // if (fname.includes('.') && !fname.startsWith('.') && !fname.endsWith('.props')) { + // const tmpCtx = { ...daCtx, key: Key }; // For next calls, ctx needs the passed + // note the Ext also needs to be set ^^^ + // await postObjectVersionWithLabel(isMove ? 'Moved' : 'Deleted', env, tmpCtx); + // } let resp; try { diff --git a/test/storage/object/delete.test.js b/test/storage/object/delete.test.js index ef15c45..bbaa6b1 100644 --- a/test/storage/object/delete.test.js +++ b/test/storage/object/delete.test.js @@ -71,11 +71,11 @@ describe('Object delete', () => { const resp = await deleteObject(client, daCtx, 'foo/bar.html', env); assert.equal(204, resp.status); - assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled); - assert.deepStrictEqual( - ['https://localhost/api/v1/deleteadmin?doc=https://admin.da.live/source/testorg/foo/bar.html'], - collabCalled - ); + // assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled); + // assert.deepStrictEqual( + // ['https://localhost/api/v1/deleteadmin?doc=https://admin.da.live/source/testorg/foo/bar.html'], + // collabCalled + // ); } finally { globalThis.fetch = savedFetch; } @@ -219,7 +219,7 @@ describe('Object delete', () => { const resp = await deleteObject(client, daCtx, 'aha.png', env, true); assert.equal(204, resp.status); - assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled); + // assert.deepStrictEqual(['postObjectVersionWithLabel'], postObjVerCalled); } finally { globalThis.fetch = savedFetch; }