Skip to content

Commit e408590

Browse files
authored
[Release] Fix bug with the /hierarchy API sending invalid requests (#2202)
1 parent d595717 commit e408590

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
@@ -8628,12 +8628,21 @@ export class MatrixClient extends EventEmitter {
86288628
$roomId: roomId,
86298629
});
86308630

8631-
return this.http.authedRequest<IRoomHierarchy>(undefined, Method.Get, path, {
8631+
const queryParams: Record<string, string | string[]> = {
86328632
suggested_only: String(suggestedOnly),
8633-
max_depth: maxDepth?.toString(),
8634-
from: fromToken,
8635-
limit: limit?.toString(),
8636-
}, undefined, {
8633+
};
8634+
8635+
if (limit !== undefined) {
8636+
queryParams["limit"] = limit.toString();
8637+
}
8638+
if (maxDepth !== undefined) {
8639+
queryParams["max_depth"] = maxDepth.toString();
8640+
}
8641+
if (fromToken !== undefined) {
8642+
queryParams["from"] = fromToken;
8643+
}
8644+
8645+
return this.http.authedRequest<IRoomHierarchy>(undefined, Method.Get, path, queryParams, undefined, {
86378646
prefix: "/_matrix/client/unstable/org.matrix.msc2946",
86388647
}).catch(e => {
86398648
if (e.errcode === "M_UNRECOGNIZED") {

0 commit comments

Comments
 (0)