From 043d913f0702a6c86b30c154c826d2f03b760ed7 Mon Sep 17 00:00:00 2001 From: ashika112 <155593080+ashika112@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:03:54 -0700 Subject: [PATCH] [Chore] Enable Integ test and tagged release on Multi-bucket work (#13619) --- .github/workflows/push-preid-release.yml | 2 +- .../src/providers/s3/apis/internal/copy.ts | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) 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,