correctly handle MXIDs with not just-domain server names; update testdata config to include that case by default; fixes #239
This commit is contained in:
@@ -44,6 +44,11 @@ export function generateRandomMXID(): string {
|
||||
export function returnMXID(input: string | Identifier): string {
|
||||
const homeserver = localStorage.getItem("home_server");
|
||||
|
||||
// when homeserver is not (just) a domain name, but a domain:port or even an IPv6 address
|
||||
if (input.endsWith(homeserver) && input.startsWith("@")) {
|
||||
return input as string; // Already a valid MXID
|
||||
}
|
||||
|
||||
// Check if the input already looks like a valid MXID (i.e., starts with "@" and contains ":")
|
||||
if (isMXID(input)) {
|
||||
return input as string; // Already a valid MXID
|
||||
|
Reference in New Issue
Block a user