Support v12 room IDs
MSC: https://github.com/matrix-org/matrix-spec-proposals/pull/4291 Pre-disclosure: https://matrix.org/blog/2025/07/security-predisclosure/
This commit is contained in:
+9
-2
@@ -18,7 +18,7 @@ import {createEnum} from "./utils/enum.js";
|
||||
import {orderedUnique} from "./utils/unique.js";
|
||||
|
||||
const ROOMALIAS_PATTERN = /^#([^:]*):(.+)$/;
|
||||
const ROOMID_PATTERN = /^!([^:]*):(.+)$/;
|
||||
const ROOMID_PATTERN = /^!([^:]*)(:(.+))?$/; // As of room version 12, room IDs don't have domains
|
||||
const USERID_PATTERN = /^@([^:]+):(.+)$/;
|
||||
const EVENTID_PATTERN = /^$([^:]+):(.+)$/;
|
||||
const GROUPID_PATTERN = /^\+([^:]+):(.+)$/;
|
||||
@@ -166,12 +166,19 @@ export class Link {
|
||||
}
|
||||
|
||||
constructor(clientId, viaServers, identifierKind, localPart, server, webInstances, eventId) {
|
||||
const servers = [server];
|
||||
const servers = [];
|
||||
if (server !== undefined) {
|
||||
servers.push(server); // v12 rooms don't have domains, and therefore no server
|
||||
}
|
||||
servers.push(...viaServers);
|
||||
this.webInstances = webInstances;
|
||||
this.servers = orderedUnique(servers);
|
||||
this.identifierKind = identifierKind;
|
||||
if (identifierKind === IdentifierKind.RoomId && !server) {
|
||||
this.identifier = `${asPrefix(identifierKind)}${localPart}`;
|
||||
} else {
|
||||
this.identifier = `${asPrefix(identifierKind)}${localPart}:${server}`;
|
||||
}
|
||||
this.eventId = eventId;
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user