Skip to content

fix(ui): encode the CEL query in the maintenance edit URL - #6964

Open
nazarli-shabnam wants to merge 1 commit into
keephq:mainfrom
nazarli-shabnam:fix/5389-maintenance-cel-param
Open

nazarli-shabnam wants to merge 1 commit into
keephq:mainfrom
nazarli-shabnam:fix/5389-maintenance-cel-param

Conversation

@nazarli-shabnam

Copy link
Copy Markdown
Contributor

Closes #5389

Problem

Clicking edit on a maintenance rule runs router.replace(/maintenance?cel=${rule.cel_query}) with the raw CEL query. Characters such as &&, == and # are not URL-encoded, so the query string is cut off and the CEL does not come through for complex expressions. This is the first bug in #5389.

Fix

maintenance.tsx wraps the query in encodeURIComponent, as other pages that link with a cel parameter already do (for example service-node.tsx).

Tests

Added app/(keep)/maintenance/__tests__/maintenance.test.tsx: it opens a rule whose CEL contains ==, && and quotes through the table's editCallback and expects router.replace to receive the encoded URL.

Run with npx jest in a throwaway node:22-slim container after npm ci --ignore-scripts from the repo lockfile. Before the fix it failed (received the raw name == "Disk" && ...); after the fix it passed. Prettier 3.5.3 --check passes on both files.

Not verified

  • No browser check. I did not confirm that the form in the issue now shows the full CEL, only that the URL is encoded.
  • The issue also reports that the edit form does not show the CEL and asks for extra URL parameters (name, description, status, start time). I did not touch those; they look like separate changes, so this PR may fix only part of the report.
  • I did not run next lint, tsc or e2e tests.

AI disclosure

Claude (Anthropic) helped investigate the bug and draft the change and this description. I reviewed the diff.

Opening a maintenance rule for editing put the raw CEL query into /maintenance?cel=..., so characters such as && and == were not URL-encoded and the query was cut off. Encode it with encodeURIComponent, as the other pages that link with a cel parameter do.

Closes keephq#5389

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: Maintenance window page cel query parameter doesn't work correctly

1 participant