Skip to content

Commit 8a55162

Browse files
committed
fix(storage): do not throw error when file does not exist in exists() method
1 parent d5f54f0 commit 8a55162

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/core/storage-js/src/packages/StorageFileApi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ export default class StorageFileApi {
617617
const originalError = error.originalError as unknown as { status: number }
618618

619619
if ([400, 404].includes(originalError?.status)) {
620-
return { data: false, error }
620+
return { data: false, error: null }
621621
}
622622
}
623623

packages/core/storage-js/test/storageFileApi.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ describe('Object API', () => {
559559

560560
const resNotExists = await storage.from(bucketName).exists('do-not-exists')
561561
expect(resNotExists.data).toEqual(false)
562+
expect(resNotExists.error).toBeNull()
562563

563564
// should throw when .throwOnError is enabled
564565
await expect(

0 commit comments

Comments
 (0)