From 3ddd89be52a33388078d55941c844ce8562fc236 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Tue, 11 Nov 2025 11:20:36 +0100 Subject: [PATCH] fix: error when copying a file that exists --- src/storage/object/copy.js | 1 + test/storage/object/copy.test.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/storage/object/copy.js b/src/storage/object/copy.js index c19c8aa8..a206c4e7 100644 --- a/src/storage/object/copy.js +++ b/src/storage/object/copy.js @@ -90,6 +90,7 @@ export const copyFile = async (config, env, daCtx, sourceKey, details, isRename) { bucket: daCtx.bucket, org: daCtx.org, key: sourceKey }, ); return /* await */ putObjectWithVersion(env, daCtx, { + bucket: daCtx.bucket, org: daCtx.org, key: Key, body: original.body, diff --git a/test/storage/object/copy.test.js b/test/storage/object/copy.test.js index 2305ba9b..6fc6ca1f 100644 --- a/test/storage/object/copy.test.js +++ b/test/storage/object/copy.test.js @@ -450,6 +450,7 @@ describe('Object copy', () => { assert.strictEqual(puwv.length, 1); assert.strictEqual(puwv[0].c, daCtx); assert.strictEqual(puwv[0].e, env); + assert.strictEqual(puwv[0].u.bucket, 'mybucket'); assert.strictEqual(puwv[0].u.body, 'original body'); assert.strictEqual(puwv[0].u.contentLength, 42); assert.strictEqual(puwv[0].u.key, 'xdst/abc/def.html');