fix(matrix): land #31201 preserve room ID casing (@williamos-dev)

Landed from contributor PR #31201 by @williamos-dev.

Co-authored-by: williamos-dev <williamos-dev@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-03-02 03:09:00 +00:00
parent efd303dbc4
commit 166ae8f002
3 changed files with 14 additions and 1 deletions

View File

@@ -71,4 +71,15 @@ describe("matrix directory live", () => {
expect(result).toEqual([]);
expect(resolveMatrixAuth).not.toHaveBeenCalled();
});
it("preserves original casing for room IDs without :server suffix", async () => {
const mixedCaseId = "!EonMPPbOuhntHEHgZ2dnBO-c_EglMaXlIh2kdo8cgiA";
const result = await listMatrixDirectoryGroupsLive({
cfg,
query: mixedCaseId,
});
expect(result).toHaveLength(1);
expect(result[0].id).toBe(mixedCaseId);
});
});

View File

@@ -174,7 +174,8 @@ export async function listMatrixDirectoryGroupsLive(
}
if (query.startsWith("!")) {
return [createGroupDirectoryEntry({ id: query, name: query })];
const originalId = params.query?.trim() ?? query;
return [createGroupDirectoryEntry({ id: originalId, name: originalId })];
}
const joined = await fetchMatrixJson<MatrixJoinedRoomsResponse>({