Fix invalid matrix.to event link generation (#2717)
This commit is contained in:
parent
4bbc94cd7e
commit
13b4aa5f40
2 changed files with 3 additions and 5 deletions
|
|
@ -327,11 +327,9 @@ export const MessageCopyLinkItem = as<
|
|||
const mx = useMatrixClient();
|
||||
|
||||
const handleCopy = () => {
|
||||
const roomIdOrAlias = getCanonicalAliasOrRoomId(mx, room.roomId);
|
||||
const eventId = mEvent.getId();
|
||||
const viaServers = isRoomAlias(roomIdOrAlias) ? undefined : getViaServers(room);
|
||||
if (!eventId) return;
|
||||
copyToClipboard(getMatrixToRoomEvent(roomIdOrAlias, eventId, viaServers));
|
||||
copyToClipboard(getMatrixToRoomEvent(room.roomId, eventId, getViaServers(room)));
|
||||
onClose?.();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ export const getMatrixToRoom = (roomIdOrAlias: string, viaServers?: string[]): s
|
|||
};
|
||||
|
||||
export const getMatrixToRoomEvent = (
|
||||
roomIdOrAlias: string,
|
||||
roomId: string,
|
||||
eventId: string,
|
||||
viaServers?: string[]
|
||||
): string => {
|
||||
let fragment = `${roomIdOrAlias}/${eventId}`;
|
||||
let fragment = `${roomId}/${eventId}`;
|
||||
|
||||
if (Array.isArray(viaServers) && viaServers.length > 0) {
|
||||
fragment = withViaServers(fragment, viaServers);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue