From bc302ee4eb9a89253077ce08130f1e09120173c4 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Mon, 11 Sep 2023 11:51:06 -0700 Subject: [PATCH] fix(storage): rename list request path to prefix (#11997) fix(storage): list request would expose prefix instead of path Co-authored-by: Sridhar Co-authored-by: Aaron S <94858815+stocaaro@users.noreply.github.com> --- packages/storage/__tests__/providers/s3/apis/list.test.ts | 6 +++--- packages/storage/src/providers/s3/apis/internal/list.ts | 2 +- packages/storage/src/types/requests.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/storage/__tests__/providers/s3/apis/list.test.ts b/packages/storage/__tests__/providers/s3/apis/list.test.ts index 6defa0e89aa..b57d282f096 100644 --- a/packages/storage/__tests__/providers/s3/apis/list.test.ts +++ b/packages/storage/__tests__/providers/s3/apis/list.test.ts @@ -125,7 +125,7 @@ describe('list API', () => { expect.assertions(4); const customPageSize = 5; const response = await list({ - path: 'listWithTokenResultsPath', + prefix: 'listWithTokenResultsPath', options: { accessLevel: 'guest', pageSize: customPageSize, @@ -148,7 +148,7 @@ describe('list API', () => { mockListObjectsV2ApiWithPages(3); const result = await list({ - path: 'listALLResultsPath', + prefix: 'listALLResultsPath', options: { accessLevel: 'guest', listAll: true }, }); @@ -185,7 +185,7 @@ describe('list API', () => { expect.assertions(3); let response = await list({ - path: 'emptyListResultsPath', + prefix: 'emptyListResultsPath', options: { accessLevel: 'guest', }, diff --git a/packages/storage/src/providers/s3/apis/internal/list.ts b/packages/storage/src/providers/s3/apis/internal/list.ts index 3f7fc37776c..fff8647d7ad 100644 --- a/packages/storage/src/providers/s3/apis/internal/list.ts +++ b/packages/storage/src/providers/s3/apis/internal/list.ts @@ -34,7 +34,7 @@ export const list = async ( | StorageListRequest | StorageListRequest ): Promise => { - const { options = {}, path = '' } = listRequest ?? {}; + const { options = {}, prefix: path = '' } = listRequest ?? {}; const { s3Config, bucket, diff --git a/packages/storage/src/types/requests.ts b/packages/storage/src/types/requests.ts index 27eff108b58..2b8f59db3b1 100644 --- a/packages/storage/src/types/requests.ts +++ b/packages/storage/src/types/requests.ts @@ -18,7 +18,7 @@ export type StorageOperationRequest = { export type StorageListRequest< Options extends StorageListAllOptions | StorageListPaginateOptions > = { - path?: string; + prefix?: string; options?: Options; };