From 19cbfc403a7da9076a7250ce8ffcdae728914da9 Mon Sep 17 00:00:00 2001 From: dshvaika Date: Tue, 15 Sep 2026 13:44:36 +0300 Subject: [PATCH] fix(iot-hub): keep the grouped query string well-formed without text --- .../shared/models/iot-hub/iot-hub-version.models.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts b/ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts index 4c1f79718b..c48a232098 100644 --- a/ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts +++ b/ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts @@ -163,14 +163,16 @@ export class MpItemVersionQuery { */ public toGroupedQuery(): string { const text = this.pageLink.textSearch?.trim(); - let query = '?'; + const parts: string[] = []; if (text?.length) { - query += `textSearch=${encodeURIComponent(text)}&`; + parts.push(`textSearch=${encodeURIComponent(text)}`); } if (this.pageLink.sortOrder) { - query += `sortProperty=${this.pageLink.sortOrder.property}&`; + parts.push(`sortProperty=${this.pageLink.sortOrder.property}`); } - return query + this.filtersToQuery(); + // filtersToQuery() emits leading ampersands, which is what toQuery() needs after a page link; + // here they may be the whole query string, so the first one is dropped. + return `?${`${parts.join('&')}${this.filtersToQuery()}`.replace(/^&/, '')}`; } public toQuery(): string {