mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: parse raw query string for deep link params to avoid double-decode
Previous fix used URLSearchParams.get() which already fully decodes, then called decodeURIComponent() again causing double-decode of % sequences. Parse raw query string pairs directly instead — decodeURIComponent does not treat + as space, preserving base64.
This commit is contained in:
@@ -61,12 +61,19 @@ export default function DeepLinkRedirect() {
|
||||
const logoLetter = branding?.logo_letter || import.meta.env.VITE_APP_LOGO || 'V';
|
||||
const logoUrl = branding ? brandingApi.getLogoUrl(branding) : null;
|
||||
|
||||
// Get raw URL parameter preserving '+' chars (URLSearchParams decodes '+' as space, breaking base64 in crypto links)
|
||||
const getRawParam = (key: string) => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const raw = params.get(key);
|
||||
if (!raw) return '';
|
||||
return decodeURIComponent(raw.replace(/ /g, '+'));
|
||||
// Parse raw query string to preserve '+' chars in base64 crypto links.
|
||||
// URLSearchParams decodes '+' as space, breaking ss://, vless:// etc.
|
||||
// decodeURIComponent does NOT treat '+' as space, so parsing raw pairs is correct.
|
||||
const getRawParam = (key: string): string => {
|
||||
const search = window.location.search.substring(1);
|
||||
for (const pair of search.split('&')) {
|
||||
const idx = pair.indexOf('=');
|
||||
if (idx === -1) continue;
|
||||
if (decodeURIComponent(pair.substring(0, idx)) === key) {
|
||||
return decodeURIComponent(pair.substring(idx + 1));
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
// Get parameters
|
||||
|
||||
Reference in New Issue
Block a user