Repository navigation
fix(ui): encode the CEL query in the maintenance edit URL - #6964
Open
nazarli-shabnam wants to merge 1 commit into
Open
nazarli-shabnam wants to merge 1 commit into
nazarli-shabnam wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsxwraps the query inencodeURIComponent, as other pages that link with acelparameter already do (for exampleservice-node.tsx).Tests
Added
app/(keep)/maintenance/__tests__/maintenance.test.tsx: it opens a rule whose CEL contains==,&&and quotes through the table'seditCallbackand expectsrouter.replaceto receive the encoded URL.Run with
npx jestin a throwawaynode:22-slimcontainer afternpm ci --ignore-scriptsfrom the repo lockfile. Before the fix it failed (received the rawname == "Disk" && ...); after the fix it passed. Prettier 3.5.3--checkpasses on both files.Not verified
next lint,tscor e2e tests.AI disclosure
Claude (Anthropic) helped investigate the bug and draft the change and this description. I reviewed the diff.