Skip to content

Commit 4f9f9d8

Browse files
committed
chore: address feedbacks
1 parent 048ea00 commit 4f9f9d8

File tree

1 file changed

+16
-3
lines changed
  • packages/storage/src/providers/s3/apis/internal

1 file changed

+16
-3
lines changed

packages/storage/src/providers/s3/apis/internal/copy.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ const copyWithPath = async (
6161

6262
const { bucket: sourceBucket } = await resolveS3ConfigAndInput(amplify, {
6363
path: input.source.path,
64-
options: { ...input.source },
64+
options: {
65+
locationCredentialsProvider: input.options?.locationCredentialsProvider,
66+
...input.source,
67+
},
6568
});
6669

6770
// The bucket, region, credentials of s3 client are resolved from destination.
@@ -125,7 +128,12 @@ export const copyWithKey = async (
125128
const { bucket: sourceBucket, keyPrefix: sourceKeyPrefix } =
126129
await resolveS3ConfigAndInput(amplify, {
127130
...input,
128-
options: input.source,
131+
options: {
132+
// @ts-expect-error: 'options' does not exist on type 'CopyInput'. In case of JS users set the location
133+
// credentials provider option, resolveS3ConfigAndInput will throw validation error.
134+
locationCredentialsProvider: input.options?.locationCredentialsProvider,
135+
...input.source,
136+
},
129137
});
130138

131139
// The bucket, region, credentials of s3 client are resolved from destination.
@@ -136,7 +144,12 @@ export const copyWithKey = async (
136144
keyPrefix: destinationKeyPrefix,
137145
} = await resolveS3ConfigAndInput(amplify, {
138146
...input,
139-
options: input.destination,
147+
options: {
148+
// @ts-expect-error: 'options' does not exist on type 'CopyInput'. In case of JS users set the location
149+
// credentials provider option, resolveS3ConfigAndInput will throw validation error.
150+
locationCredentialsProvider: input.options?.locationCredentialsProvider,
151+
...input.destination,
152+
},
140153
}); // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.
141154

142155
// TODO(ashwinkumar6) V6-logger: warn `You may copy files from another user if the source level is "protected", currently it's ${srcLevel}`

0 commit comments

Comments
 (0)