Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 760d269

Browse files
authored
Fix relative link handling in Element Desktop (#7708)
1 parent f0446a2 commit 760d269

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/linkify-matrix.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ const escapeRegExp = function(string): string {
132132
};
133133

134134
// Recognise URLs from both our local and official Element deployments.
135-
// Anyone else really should be using matrix.to.
135+
// Anyone else really should be using matrix.to. vector:// allowed to support Element Desktop relative links.
136136
export const ELEMENT_URL_PATTERN =
137-
"^(?:https?://)?(?:" +
137+
"^(?:vector://|https?://)?(?:" +
138138
escapeRegExp(window.location.host + window.location.pathname) + "|" +
139139
"(?:www\\.)?(?:riot|vector)\\.im/(?:app|beta|staging|develop)/|" +
140140
"(?:app|beta|staging|develop)\\.element\\.io/" +

src/utils/permalinks/Permalinks.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,11 @@ export function tryTransformEntityToPermalink(entity: string): string {
362362
* @returns {string} The transformed permalink or original URL if unable.
363363
*/
364364
export function tryTransformPermalinkToLocalHref(permalink: string): string {
365-
if (!permalink.startsWith("http:") && !permalink.startsWith("https:") && !permalink.startsWith("matrix:")) {
365+
if (!permalink.startsWith("http:") &&
366+
!permalink.startsWith("https:") &&
367+
!permalink.startsWith("matrix:") &&
368+
!permalink.startsWith("vector:") // Element Desktop
369+
) {
366370
return permalink;
367371
}
368372

0 commit comments

Comments
 (0)