Skip to content

Commit 544cdb1

Browse files
fix
1 parent 58ba6e8 commit 544cdb1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/web/src/lib/utils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,18 @@ export const createPathWithQueryParams = (path: string, ...queryParams: [string,
6262
return path;
6363
}
6464

65-
const queryString = queryParams.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value ?? '')}`).join('&');
65+
const queryString = queryParams.map(([key, value]) => `${encodeURIComponent(key)}=${encodeRFC3986URIComponent(value ?? '')}`).join('&');
6666
return `${path}?${queryString}`;
6767
}
6868

69+
// @see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#encoding_for_rfc3986
70+
const encodeRFC3986URIComponent = (str: string) => {
71+
return encodeURIComponent(str).replace(
72+
/[!'()*]/g,
73+
(c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`,
74+
);
75+
}
76+
6977
type AuthProviderInfo = {
7078
id: string;
7179
name: string;

0 commit comments

Comments
 (0)