Skip to content

Commit 735ccca

Browse files
authored
Fix bug with the /hierarchy API sending invalid requests (#2201)
1 parent 946f47e commit 735ccca

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/client.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8744,12 +8744,21 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
87448744
$roomId: roomId,
87458745
});
87468746

8747-
return this.http.authedRequest<IRoomHierarchy>(undefined, Method.Get, path, {
8747+
const queryParams: Record<string, string | string[]> = {
87488748
suggested_only: String(suggestedOnly),
8749-
max_depth: maxDepth?.toString(),
8750-
from: fromToken,
8751-
limit: limit?.toString(),
8752-
}, undefined, {
8749+
};
8750+
8751+
if (limit !== undefined) {
8752+
queryParams["limit"] = limit.toString();
8753+
}
8754+
if (maxDepth !== undefined) {
8755+
queryParams["max_depth"] = maxDepth.toString();
8756+
}
8757+
if (fromToken !== undefined) {
8758+
queryParams["from"] = fromToken;
8759+
}
8760+
8761+
return this.http.authedRequest<IRoomHierarchy>(undefined, Method.Get, path, queryParams, undefined, {
87538762
prefix: "/_matrix/client/unstable/org.matrix.msc2946",
87548763
}).catch(e => {
87558764
if (e.errcode === "M_UNRECOGNIZED") {

0 commit comments

Comments
 (0)