Repository navigation
fix(permissions): ignore NotADirectory and strip BOM before empty check - #4658
Open
webdevsamran wants to merge 1 commit into
Open
webdevsamran wants to merge 1 commit into
webdevsamran wants to merge 1 commit into
Conversation
Signed-off-by: Samran Asif <samranwebdev2000@gmail.com>
|
|
📊 Automated PR Analysis
SummaryFixes the Claude Code settings permission loader to treat ErrorKind::NotADirectory the same as NotFound (so a non-directory parent like a Review Checklist
Linked issues: #4651 Analyzed automatically by wshm · This is an automated analysis, not a human review. |
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.
Summary
ErrorKind::NotADirectoryidentical toNotFoundwhen reading Claude Code settings files so non-directory parents (e.g..claudeas a regular file) fail closed instead of triggering unreadable-file warnings and catch-allAsk.\u{feff}) before checkingcontent.trim().is_empty()so BOM-only settings files are correctly treated as empty and skipped rather than failing JSON parsing.Test plan
src/hooks/permissions.rs:test_bom_only_settings_file_adds_no_rules: verifies that BOM-only and BOM-plus-whitespace settings files add no rules.test_not_a_directory_settings_file_adds_no_rules: verifies that a settings path under a regular file parent adds no rules without error.cargo fmt --checkcleanly.AI Disclosure: Implementation assisted by agentic workflow; logic, bounds, and regression tests thoroughly inspected.