Skip to content

Commit abc86fa

Browse files
committed
fix(storage): remove trailing slash from baseUrl normalization
1 parent 9792a92 commit abc86fa

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ describe('Bucket API Error Handling', () => {
6060
'http://localhost:1234/storage/v1',
6161
'support local host with port without modification',
6262
],
63+
[
64+
'http://localhost:1234',
65+
'http://localhost:1234',
66+
'support local host only with port',
67+
],
6368
]
6469

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

0 commit comments

Comments
 (0)