fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148)#151
Open
Lakshya77089 wants to merge 1 commit into
Open
fix: strip UTF-8 BOM before parsing settings.json in ponytail-activate (#148)#151Lakshya77089 wants to merge 1 commit into
Lakshya77089 wants to merge 1 commit into
Conversation
DietrichGebert#148) settings.json written by Notepad or VS Code on Windows can carry a UTF-8 BOM. JSON.parse then throws SyntaxError, the outer catch swallows it, hasStatusline stays false, and the statusline setup nudge is never emitted. Strip the leading BOM before parsing, matching the existing handling in ponytail-mode-tracker.js. (DietrichGebert#96 added a null guard but not BOM stripping.)
b895026 to
20aa9f7
Compare
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
Fixes #148. ponytail-activate.js:46 read and parsed
~/.claude/settings.jsonwithout stripping a UTF-8 BOM. On Windows,settings.jsonwritten by Notepad or VS Code can carry a BOM;JSON.parsethen throwsSyntaxError, the outercatchat line 68 silently swallows it,hasStatuslinestaysfalse, and the statusline setup nudge is never emitted.Fix
Strip the leading BOM before parsing, matching the handling already present in ponytail-mode-tracker.js:
Notes
escape matches the sibling hook byte-for-byte, the BOM strip parses a BOM-prefixed payload, andnode --checkpasses.Severity per the issue: MEDIUM — silent failure; the statusline nudge never surfaces for users with a BOM-prefixed
settings.json.