Skip to content

Commit

Permalink
fix(notifications): correctly append query parameters (#1547)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores authored Jan 31, 2025
1 parent e12c454 commit b519094
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/app/Shared/Services/NotificationChannel.service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export class NotificationChannel {
// parameters instead so that the plugin backend can fall back to finding those.
return this.ctx.headers().pipe(
map((headers) => {
const u = URL.parse(url);
if (!u) {
return url;
}
const searchParams = new URLSearchParams();
if (headers.has('CRYOSTAT-SVC-NS')) {
searchParams.append('ns', headers.get('CRYOSTAT-SVC-NS')!);
Expand All @@ -112,9 +116,14 @@ export class NotificationChannel {
searchParams.append('name', headers.get('CRYOSTAT-SVC-NAME')!);
}
if (searchParams.size > 0) {
return `${url}?${searchParams}`;
if (!u.search) {
u.search = '?';
} else {
u.search += '&';
}
u.search += searchParams.toString();
}
return url;
return u.toString();
}),
);
}),
Expand Down

0 comments on commit b519094

Please sign in to comment.