fix: make room directory correct when using a homeserver with explicit port
Server names are allowed to contain ':' to specify a port, see https://matrix.org/docs/spec/appendices#server-name User ids on the other hand are not allowed to contain ':', even historical user ids, see https://matrix.org/docs/spec/appendices#historical-user-ids Therefore we can use change the regex to make sure the localpart is not allowed to contain ':'.pull/21833/head
parent
3154dd6cd4
commit
f575625c7a
|
@ -261,7 +261,7 @@ class _MatrixClientPeg implements IMatrixClientPeg {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getHomeserverName(): string {
|
public getHomeserverName(): string {
|
||||||
const matches = /^@.+:(.+)$/.exec(this.matrixClient.credentials.userId);
|
const matches = /^@[^:]+:(.+)$/.exec(this.matrixClient.credentials.userId);
|
||||||
if (matches === null || matches.length < 1) {
|
if (matches === null || matches.length < 1) {
|
||||||
throw new Error("Failed to derive homeserver name from user ID!");
|
throw new Error("Failed to derive homeserver name from user ID!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue