Skip to content

Commit

Permalink
Merge pull request #272 from matrix-org/t3chguy-patch-1
Browse files Browse the repository at this point in the history
Fix over-encoding issues in Element URIs
  • Loading branch information
thibaultamartin authored Jun 9, 2022
2 parents c39e7e1 + 58f63c4 commit f08c120
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/open/clients/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ export class Element {
let fragmentPath;
switch (link.kind) {
case LinkKind.User:
fragmentPath = `user/${link.identifier}`;
fragmentPath = `user/${encodeURIComponent(link.identifier)}`;
break;
case LinkKind.Room:
fragmentPath = `room/${link.identifier}`;
fragmentPath = `room/${encodeURIComponent(link.identifier)}`;
break;
case LinkKind.Group:
fragmentPath = `group/${link.identifier}`;
fragmentPath = `group/${encodeURIComponent(link.identifier)}`;
break;
case LinkKind.Event:
fragmentPath = `room/${link.identifier}/${link.eventId}`;
fragmentPath = `room/${encodeURIComponent(link.identifier)}/${encodeURIComponent(link.eventId)}`;
break;
}

Expand All @@ -77,9 +77,9 @@ export class Element {
if (isWebPlatform && trustedWebInstances.includes(link.webInstances[this.id])) {
instanceHost = link.webInstances[this.id];
}
return `https://${instanceHost}/#/${encodeURIComponent(fragmentPath)}`;
return `https://${instanceHost}/#/${fragmentPath}`;
} else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) {
return `element://vector/webapp/#/${encodeURIComponent(fragmentPath)}`;
return `element://vector/webapp/#/${fragmentPath}`;
} else {
return `element://${fragmentPath}`;
}
Expand Down

0 comments on commit f08c120

Please sign in to comment.