Handle all permitted url schemes in linkify (#11215)

* Handle all permitted url schemes in linkify

* Correctly handle optional slash protocols

* Iterate
This commit is contained in:
Michael Telatynski 2023-07-10 16:09:39 +01:00 committed by GitHub
parent 58710d129d
commit 186497a67d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 30 deletions

View file

@ -24,7 +24,7 @@ import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
import { M_POLL_END, M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import { PollStartEvent } from "matrix-js-sdk/src/extensible_events_v1/PollStartEvent";
import { PERMITTED_URL_SCHEMES } from "../HtmlUtils";
import { PERMITTED_URL_SCHEMES } from "./UrlUtils";
import { makeUserPermalink, RoomPermalinkCreator } from "./permalinks/Permalinks";
import { isSelfLocation } from "./location";

View file

@ -57,3 +57,31 @@ export function parseUrl(u: string): URL {
}
return new URL(u);
}
export const PERMITTED_URL_SCHEMES = [
"bitcoin",
"ftp",
"geo",
"http",
"https",
"im",
"irc",
"ircs",
"magnet",
"mailto",
"matrix",
"mms",
"news",
"nntp",
"openpgp4fpr",
"sip",
"sftp",
"sms",
"smsto",
"ssh",
"tel",
"urn",
"webcal",
"wtai",
"xmpp",
];