Apply URL encoding to the fragmentPath

According to RFC3986 section 3.5, only certain values are legal
in the fragment. # in particular isn't one of them, but this
is a character that appears in room names.

It shouldn't hurt to escape other, otherwise legal characters
in the fragment such as @ and :.
This commit is contained in:
James Salter 2021-11-24 17:14:26 +11:00
parent 7d22a57874
commit b302bd6829
1 changed files with 2 additions and 2 deletions

View File

@ -74,9 +74,9 @@ export class Element {
}
return `https://${instanceHost}/#/${fragmentPath}`;
} else if (platform === Platform.Linux || platform === Platform.Windows || platform === Platform.macOS) {
return `element://vector/webapp/#/${fragmentPath}`;
return `element://vector/webapp/#/${encodeURIComponent(fragmentPath)}`;
} else {
return `element://${fragmentPath}`;
return `element://${encodeURIComponent(fragmentPath)}`;
}
}