Preserve keeplist prefix case in UI validation#11
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aligns the UI keeplist prefix handling in main.ts with the existing mixed-case support already present in the core logic.ts. Previously, applyPrefixValue lowercased the user's input before storing it, causing the active keeplist name shown in the UI and passed to core functions to always be lowercase, even though logic.ts (via validateKeeplistName and isProtectedKeeplistPath) already accepted and operated on mixed-case prefixes.
Changes:
- Removed
.toLowerCase()normalization inapplyPrefixValue, updated the validation regex from[a-z0-9_-]to[A-Za-z0-9_-], and now stores the trimmed (not lowercased) value askeeplistPrefix. - Added a regression test in
logic_test.tsto assert thatresolveKeeplistName("Vanilla_Profile")returns"#Vanilla_Profile-keeplist.txt", confirming mixed-case prefix preservation end-to-end.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
main.ts |
Removes lowercase normalization in applyPrefixValue; updates validation regex to allow uppercase letters; stores the user-entered case directly. |
logic_test.ts |
Adds a mixed-case assertion to the existing resolveKeeplistName test to cover the preserved-case behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Motivation
Description
applyPrefixValue(removed.toLowerCase()), validate the trimmed value against/^[A-Za-z0-9_-]+$/, and assignkeeplistPrefix = trimmedso the active keeplist label reflects the user-entered case inmain.ts.logic_test.tsto ensureresolveKeeplistNamepreserves mixed-case prefixes (e.g.,Vanilla_Profile).Testing
deno fmt main.ts logic_test.tswhich completed successfully.deno task testand all 58 tests passed.Codex Task