Skip to content

Commit 974366b

Browse files
committed
Make sure bucket is passed where needed for copy/move operations.
1 parent 57cc602 commit 974366b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/storage/object/copy.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,20 @@ export const copyFile = async (config, env, daCtx, sourceKey, details, isRename)
6969
tags: ['METADATA', 'IF-NONE-MATCH'],
7070
},
7171
);
72+
7273
const resp = await client.send(new CopyObjectCommand(input));
7374
return resp;
7475
} catch (e) {
7576
if (e.$metadata.httpStatusCode === 412) {
7677
// Not the happy path - something is at the destination already.
7778
if (!isRename) {
7879
// This is a copy so just put the source into the target to keep the history.
79-
80-
const original = await getObject(env, { org: daCtx.org, key: sourceKey });
80+
const original = await getObject(
81+
env,
82+
{ bucket: daCtx.bucket, org: daCtx.org, key: sourceKey },
83+
);
8184
return /* await */ putObjectWithVersion(env, daCtx, {
85+
bucket: daCtx.bucket,
8286
org: daCtx.org,
8387
key: Key,
8488
body: original.body,
@@ -108,7 +112,6 @@ export const copyFile = async (config, env, daCtx, sourceKey, details, isRename)
108112

109113
export default async function copyObject(env, daCtx, details, isRename) {
110114
if (details.source === details.destination) return { body: '', status: 409 };
111-
112115
const config = getS3Config(env);
113116
const client = new S3Client(config);
114117

src/storage/object/list.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export default async function listObjects(env, daCtx, maxKeys) {
3737
const command = new ListObjectsV2Command(input);
3838
try {
3939
const resp = await client.send(command);
40-
// console.log(resp);
4140
const body = formatList(resp);
4241
return {
4342
body: JSON.stringify(body),

0 commit comments

Comments
 (0)