@supabase/storage-js 2.110.8-canary.1 → 2.110.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +14 -3
- package/dist/index.mjs.map +1 -1
- package/dist/umd/supabase.js +1 -1
- package/package.json +1 -1
- package/src/lib/common/helpers.ts +13 -0
- package/src/lib/version.ts +1 -1
- package/src/packages/StorageBucketApi.ts +2 -1
- package/src/packages/StorageFileApi.ts +2 -2
package/dist/index.cjs
CHANGED
|
@@ -276,6 +276,17 @@ const isValidBucketName = (bucketName) => {
|
|
|
276
276
|
if (bucketName.includes("/") || bucketName.includes("\\")) return false;
|
|
277
277
|
return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
|
|
278
278
|
};
|
|
279
|
+
/**
|
|
280
|
+
* Percent-encodes each segment of a storage path so URL delimiters within a
|
|
281
|
+
* key (e.g. `?`, `#`) can't be interpreted as a querystring/fragment start.
|
|
282
|
+
*
|
|
283
|
+
* Splits on `/` so real path separators stay literal — the storage server
|
|
284
|
+
* routes on them and decodes each segment back to the original key.
|
|
285
|
+
*
|
|
286
|
+
* @param path - A bucket id or `bucketId/objectKey` path
|
|
287
|
+
* @returns The path with each `/`-delimited segment percent-encoded
|
|
288
|
+
*/
|
|
289
|
+
const encodeStoragePath = (path) => path.split("/").map(encodeURIComponent).join("/");
|
|
279
290
|
|
|
280
291
|
//#endregion
|
|
281
292
|
//#region src/lib/common/fetch.ts
|
|
@@ -1409,7 +1420,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1409
1420
|
async purgeCache(path, options, parameters) {
|
|
1410
1421
|
var _this13 = this;
|
|
1411
1422
|
return _this13.handleOperation(async () => {
|
|
1412
|
-
const _path = _this13._getFinalPath(path);
|
|
1423
|
+
const _path = encodeStoragePath(_this13._getFinalPath(path));
|
|
1413
1424
|
const query = new URLSearchParams();
|
|
1414
1425
|
if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true");
|
|
1415
1426
|
const queryString = query.toString();
|
|
@@ -1598,7 +1609,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
1598
1609
|
|
|
1599
1610
|
//#endregion
|
|
1600
1611
|
//#region src/lib/version.ts
|
|
1601
|
-
const version = "2.110.8
|
|
1612
|
+
const version = "2.110.8";
|
|
1602
1613
|
|
|
1603
1614
|
//#endregion
|
|
1604
1615
|
//#region src/lib/constants.ts
|
|
@@ -1936,7 +1947,7 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
1936
1947
|
const query = new URLSearchParams();
|
|
1937
1948
|
if (options === null || options === void 0 ? void 0 : options.transformations) query.set("transformations", "true");
|
|
1938
1949
|
const queryString = query.toString();
|
|
1939
|
-
return await remove(_this7.fetch, `${_this7.url}/cdn/${id}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters);
|
|
1950
|
+
return await remove(_this7.fetch, `${_this7.url}/cdn/${encodeStoragePath(id)}${queryString ? `?${queryString}` : ""}`, {}, { headers: _this7.headers }, parameters);
|
|
1940
1951
|
});
|
|
1941
1952
|
}
|
|
1942
1953
|
listBucketOptionsToQueryString(options) {
|