Skip to content

Commit 636085f

Browse files
authored
fix(storage): remove trailing slash from baseUrl normalization (#1589)
Co-authored-by: tamanyan <[email protected]>
1 parent f4cb23e commit 636085f

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class StorageBucketApi {
2828
}
2929
}
3030

31-
this.url = baseUrl.href
31+
this.url = baseUrl.href.replace(/\/$/, '')
3232
this.headers = { ...DEFAULT_HEADERS, ...headers }
3333
this.fetch = resolveFetch(fetch)
3434
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ describe('Bucket API Error Handling', () => {
6060
'http://localhost:1234/storage/v1',
6161
'support local host with port without modification',
6262
],
63+
['http://localhost:1234', 'http://localhost:1234', 'support local host only with port'],
6364
]
6465

6566
urlTestCases.forEach(([inputUrl, expectUrl, description]) => {

0 commit comments

Comments
 (0)