[Routine - VT] fix(core): don't throw on a malformed file:// URI when matching stored file entries - #112
Draft
winterdrive wants to merge 1 commit into
Draft
Conversation
…d file entries matchesStoredFileEntry() called fileURLToPath() directly without a try/catch, so a hand-edited or corrupted config entry with an unescaped '%' (e.g. a file named "100%.ts") would throw "URI malformed" and abort the whole addFilesToGroup/removeFilesFromGroup/createBookmark/group-file-removal operation for every file, not just the bad entry. BookmarkManager already guards the equivalent fileURLToPath() call; FileEntryMatcher now does the same, treating a malformed entry as non-matching instead of crashing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Aug 12, 2026
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.
1. Pre-flight Check
Open PRs/branches checked (via
gh pr list --state openandgh pr diff <n> --name-only):src/core/GroupManager.ts,src/test/unit/groupManagerNonArrayConfig.test.tssrc/mcp/SkillGenerator.tssrc/dragAndDrop.ts,src/test/unit/dragIsDescendantCycleGuard.test.tssrc/core/AutoGrouper.ts,src/test/unit/autoGrouperBookmarks.test.tsi18n/*.json,src/provider.tssrc/commands.ts,src/i18n.ts,src/test/unit/copyGroupName.test.tsmcp-server/src/server.tsThis PR only touches
src/core/FileEntryMatcher.tsand its test file, which do not appear in any open PR's diff, so there is no overlap.2. Changes
matchesStoredFileEntry()(used byFileManager.addFilesToGroup/removeFilesFromGroup,BookmarkManager.createBookmark, andGroupFileRemoval) calledfileURLToPath()directly on a storedfile://entry with notry/catch. A malformed URI — e.g. a hand-edited/corrupted config entry with an unescaped%such as a file literally named100%.ts— makesfileURLToPaththrow"URI malformed", which propagated up and aborted the entire add/remove/bookmark operation for every file in the call, not just the offending entry.BookmarkManager.normalizeFileKeyalready guards the equivalent call with a try/catch. This PR applies the same defensive pattern toFileEntryMatcher.toComparableFsPath: on a malformed URI it now returnsundefined(treated as "does not match") instead of throwing.Added a regression test (
fileEntryMatcher.test.ts) assertingmatchesStoredFileEntrydoes not throw and returnsfalsefor a malformedfile://stored entry.This PR does not modify any command registrations, contributed configuration keys (
package.json), dependencies, or the tab-group serialization/storage format. It is a pure defensive-coding fix in a single pure function.3. Safety Verification
Commands run locally, all passed:
Output:
tscproduced no errors;jest --runInBand→Test Suites: 31 passed, 31 total,Tests: 204 passed, 204 total(203 pre-existing + 1 new).No
lintorformat:checkscript exists inpackage.json, so those steps were skipped.4. CI / Release Gate Note
This is a daily routine Draft PR. Package version bump (
package.json/package-lock.json) andCHANGELOG.mdupdates are intentionally deferred to the weekend release/integration PR. If CI fails solely due to the repository's version-bump/release gate, that is expected release-readiness behavior for a routine PR, not a code validation failure.🤖 Generated with Claude Code