From e6b71eddc6f027bcd0ceb97c4e804cdbf8917946 Mon Sep 17 00:00:00 2001 From: Melvin Chia Date: Wed, 26 Nov 2025 23:38:38 +0800 Subject: [PATCH] fix(shared): improve query parameter encoding in ForgeAPIClientController --- shared/src/api/core/forgeAPIClient.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/shared/src/api/core/forgeAPIClient.ts b/shared/src/api/core/forgeAPIClient.ts index 8524c0aaf..ea4801617 100644 --- a/shared/src/api/core/forgeAPIClient.ts +++ b/shared/src/api/core/forgeAPIClient.ts @@ -164,13 +164,21 @@ export class ForgeAPIClientController< let endpoint = `${this._route}` if (this._input) { - const queryParams = new URLSearchParams( - Object.fromEntries( - Object.entries(this._input).filter(([, value]) => value !== undefined) - ) - ) + const queryString = Object.entries(this._input) + .filter(([, value]) => value !== undefined) + .map(([key, value]) => { + // Manually encode to preserve + signs + const encodedKey = encodeURIComponent(key) - endpoint += `?${queryParams.toString()}` + const encodedValue = encodeURIComponent(String(value)) + + return `${encodedKey}=${encodedValue}` + }) + .join('&') + + if (queryString) { + endpoint += `?${queryString}` + } } return endpoint