@@ -61,7 +61,10 @@ const copyWithPath = async (
61
61
62
62
const { bucket : sourceBucket } = await resolveS3ConfigAndInput ( amplify , {
63
63
path : input . source . path ,
64
- options : { ...input . source } ,
64
+ options : {
65
+ locationCredentialsProvider : input . options ?. locationCredentialsProvider ,
66
+ ...input . source ,
67
+ } ,
65
68
} ) ;
66
69
67
70
// The bucket, region, credentials of s3 client are resolved from destination.
@@ -125,7 +128,12 @@ export const copyWithKey = async (
125
128
const { bucket : sourceBucket , keyPrefix : sourceKeyPrefix } =
126
129
await resolveS3ConfigAndInput ( amplify , {
127
130
...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
+ } ,
129
137
} ) ;
130
138
131
139
// The bucket, region, credentials of s3 client are resolved from destination.
@@ -136,7 +144,12 @@ export const copyWithKey = async (
136
144
keyPrefix : destinationKeyPrefix ,
137
145
} = await resolveS3ConfigAndInput ( amplify , {
138
146
...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
+ } ,
140
153
} ) ; // resolveS3ConfigAndInput does not make extra API calls or storage access if called repeatedly.
141
154
142
155
// 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