Skip to content

Commit e5226a6

Browse files
committed
Never attempt to encode OIDC segments
1 parent 7bc9d41 commit e5226a6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/domain/navigation/index.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,10 @@ export function stringifyPath(path: Path<SegmentType>): string {
239239
let urlPath = "";
240240
let prevSegment: Segment<SegmentType> | undefined;
241241
for (const segment of path.segments) {
242+
if (segment.type === "oidc-callback" || segment.type === "oidc-error") {
243+
// Do not put these segments in URL
244+
continue;
245+
}
242246
const encodedSegmentValue = encodeSegmentValue(segment.value);
243247
switch (segment.type) {
244248
case "rooms":
@@ -257,10 +261,6 @@ export function stringifyPath(path: Path<SegmentType>): string {
257261
break;
258262
case "right-panel":
259263
case "sso":
260-
case "oidc-callback":
261-
case "oidc-error":
262-
// Do not put these segments in URL
263-
continue;
264264
default:
265265
urlPath += `/${segment.type}`;
266266
if (encodedSegmentValue) {
@@ -272,7 +272,8 @@ export function stringifyPath(path: Path<SegmentType>): string {
272272
return urlPath;
273273
}
274274

275-
function encodeSegmentValue(value: SegmentType[keyof SegmentType]): string {
275+
// We exclude the OIDC segment types as they are never encoded
276+
function encodeSegmentValue(value: Exclude<SegmentType[keyof SegmentType], { state: string }>): string {
276277
if (value === true) {
277278
// Nothing to encode for boolean
278279
return "";

0 commit comments

Comments
 (0)