From 9edcf0e0a301ac17b3ff6c4e29dba96c9649b3bf Mon Sep 17 00:00:00 2001 From: Mathieu Artu Date: Fri, 13 Sep 2024 17:40:36 +0200 Subject: [PATCH] fix: user storage url construction bug --- .../controllers/user-storage/__fixtures__/mockResponses.ts | 2 +- .../src/controllers/user-storage/services.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts index 3d252c6086e..cfb16a7aeeb 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/__fixtures__/mockResponses.ts @@ -27,7 +27,7 @@ export const getMockUserStorageEndpoint = ( return `${USER_STORAGE_ENDPOINT}/${path}`; } - return `${USER_STORAGE_ENDPOINT}${createEntryPath( + return `${USER_STORAGE_ENDPOINT}/${createEntryPath( path as UserStoragePathWithFeatureAndKey, MOCK_STORAGE_KEY, )}`; diff --git a/packages/profile-sync-controller/src/controllers/user-storage/services.ts b/packages/profile-sync-controller/src/controllers/user-storage/services.ts index c925f792e45..752c4f899a0 100644 --- a/packages/profile-sync-controller/src/controllers/user-storage/services.ts +++ b/packages/profile-sync-controller/src/controllers/user-storage/services.ts @@ -58,7 +58,7 @@ export async function getUserStorage( const { bearerToken, path, storageKey, nativeScryptCrypto } = opts; const encryptedPath = createEntryPath(path, storageKey); - const url = new URL(`${USER_STORAGE_ENDPOINT}${encryptedPath}`); + const url = new URL(`${USER_STORAGE_ENDPOINT}/${encryptedPath}`); const userStorageResponse = await fetch(url.toString(), { headers: { @@ -172,7 +172,7 @@ export async function upsertUserStorage( nativeScryptCrypto, ); const encryptedPath = createEntryPath(path, storageKey); - const url = new URL(`${USER_STORAGE_ENDPOINT}${encryptedPath}`); + const url = new URL(`${USER_STORAGE_ENDPOINT}/${encryptedPath}`); const res = await fetch(url.toString(), { method: 'PUT',