You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
use URL instead of creating new a element
This commit is contained in:
@@ -260,12 +260,7 @@ function getServerName(userId) {
|
|||||||
|
|
||||||
function getHostnameFromMatrixDomain(domain) {
|
function getHostnameFromMatrixDomain(domain) {
|
||||||
if (!domain) return null;
|
if (!domain) return null;
|
||||||
|
return new URL(`https://${domain}`).hostname;
|
||||||
// The hostname might have a port, so we convert it to a URL and
|
|
||||||
// split out the real hostname.
|
|
||||||
const parser = document.createElement('a');
|
|
||||||
parser.href = "https://" + domain;
|
|
||||||
return parser.hostname;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function isHostInRegex(hostname, regexps) {
|
function isHostInRegex(hostname, regexps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user