Skip to content

Commit

Permalink
Use encodeURIComponent for Permalink components.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gnuxie committed Mar 9, 2023
1 parent d1b2dc4 commit f4e106c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/helpers/Permalinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class Permalinks {
* @returns {string} A room permalink.
*/
public static forRoom(roomIdOrAlias: string, viaServers: string[] = []): string {
return `https://matrix.to/#/${roomIdOrAlias}${Permalinks.encodeViaArgs(viaServers)}`;
return `https://matrix.to/#/${encodeURIComponent(roomIdOrAlias)}${Permalinks.encodeViaArgs(viaServers)}`;
}

/**
Expand All @@ -57,7 +57,7 @@ export class Permalinks {
* @returns {string} A user permalink.
*/
public static forUser(userId: string): string {
return `https://matrix.to/#/${userId}`;
return `https://matrix.to/#/${encodeURIComponent(userId)}`;
}

/**
Expand All @@ -68,7 +68,7 @@ export class Permalinks {
* @returns {string} An event permalink.
*/
public static forEvent(roomIdOrAlias: string, eventId: string, viaServers: string[] = []): string {
return `https://matrix.to/#/${roomIdOrAlias}/${eventId}${Permalinks.encodeViaArgs(viaServers)}`;
return `https://matrix.to/#/${encodeURIComponent(roomIdOrAlias)}/${encodeURIComponent(eventId)}${Permalinks.encodeViaArgs(viaServers)}`;
}

/**
Expand Down

0 comments on commit f4e106c

Please sign in to comment.