diff --git a/.github/workflows/push-preid-release.yml b/.github/workflows/push-preid-release.yml index 9837290ed14..8634313df1f 100644 --- a/.github/workflows/push-preid-release.yml +++ b/.github/workflows/push-preid-release.yml @@ -9,7 +9,7 @@ on: push: branches: # Change this to your branch name where "example-preid" corresponds to the preid you want your changes released on - - feat/example-preid-branch/main + - feat/multi-bucket jobs: e2e: diff --git a/packages/storage/src/providers/s3/apis/internal/copy.ts b/packages/storage/src/providers/s3/apis/internal/copy.ts index 29554ce4978..5035f897017 100644 --- a/packages/storage/src/providers/s3/apis/internal/copy.ts +++ b/packages/storage/src/providers/s3/apis/internal/copy.ts @@ -29,15 +29,18 @@ const isCopyInputWithPath = ( const storageBucketAssertion = ( sourceBucket?: StorageBucket, destBucket?: StorageBucket, -) => - // Throw assertion error when either one of bucket options is empty - { - assertValidationError( - (sourceBucket !== undefined && destBucket !== undefined) || - (!destBucket && !sourceBucket), - StorageValidationErrorCode.InvalidCopyOperationStorageBucket, - ); - }; +) => { + /** For multi-bucket, both source and destination bucket needs to be passed in + * or both can be undefined and we fallback to singleton's default value + */ + assertValidationError( + // Both src & dest bucket option is present is acceptable + (sourceBucket !== undefined && destBucket !== undefined) || + // or both are undefined is also acceptable + (!destBucket && !sourceBucket), + StorageValidationErrorCode.InvalidCopyOperationStorageBucket, + ); +}; export const copy = async ( amplify: AmplifyClassV6,