Skip to content

Commit a6f21b6

Browse files
authored
Fix parsing encoded matrix.to URL (cinnyapp#660)
From https://spec.matrix.org/v1.3/appendices/#matrixto-navigation: The components of the matrix.to URI (<identifier> and <extra parameter>) are to be percent-encoded as per RFC 3986. Historically, clients have not produced URIs which are fully encoded. Clients should try to interpret these cases to the best of their ability. For example, an unencoded room alias should still work within the client if possible
1 parent 06a4e0c commit a6f21b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/sanitize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function transformSpanTag(tagName, attribs) {
4444
}
4545

4646
function transformATag(tagName, attribs) {
47-
const userLink = attribs.href.match(/^https?:\/\/matrix.to\/#\/(@.+:.+)/);
47+
const userLink = decodeURIComponent(attribs.href).match(/^https?:\/\/matrix.to\/#\/(@.+:.+)/);
4848
if (userLink !== null) {
4949
// convert user link to pill
5050
const userId = userLink[1];

0 commit comments

Comments
 (0)