Cleanup unicode chars #5
Labels
No labels
dependencies
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
alex/opengist-viewer#5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Renovate report:
⚠️ WARN: Hidden Unicode characters have been discovered in file(s) in your repository. See your Renovate logs for more details. Please confirm that they are intended to be there, as they could be an attempt to "smuggle" text into your codebase, or used to confuse tools like Renovate or Large Language Models (LLMs)
/pi new PR
I found the issue. There's exactly one hidden Unicode character — a zero-width space (U+200B) — in
dist/index.html, inside a CSS rule that comes from the@picocss/picolibrary:Since
dist/index.htmlis a committed build artifact that CI rebuilds on every push tomaster, simply editing the file would let the character come back on the next rebuild. I need to fix it at the build step so the regenerated bundle is clean. Let me verify how bun handles build lifecycle hooks before wiring a fix.Both npm and bun respect thepostbuildlifecycle hook, andnodeis universally available. Now let me implement the fix.I'll create a small post-build script that strips hidden Unicode from the bundle, wire it into the build, and clean up the already-committed
dist/index.html.Now wire it into the build via apostbuildhook:Now run the sanitizer on the already-committeddist/index.htmlso the committed artifact is clean too:Scan is now clean (grep exit 1 = no matches). Let me verify the replacement is valid CSS and confirm the diff:The zero-width space is now replaced with the valid CSS escape\200B. Let me confirm the sanitizer is idempotent (no-op on already-clean output) and that the script file is tracked:Everything is in place. Let me create the PR.PR created: #6What I found: The only hidden Unicode character flagged by Renovate was a zero-width space (U+200B) in
dist/index.html, injected by the@picocss/picoframework inside the CSS rule:where(nav li):before{float:left;content:""}.Why a build-step fix (not just a file edit):
dist/index.htmlis a committed build artifact that CI rebuilds on every push tomaster, so editing it alone would let the character return. The fix adds apostbuildsanitizer (scripts/strip-invisible.mjs) that replaces the U+200B byte with its semantically-identical CSS escape\200B, guaranteeing clean output on every rebuild — and I also cleaned the already-committeddist/index.html. All tracked files now scan clean for invisible/bidi Unicode, and the sanitizer is idempotent.View action run | Model: zai/glm-5.2 (thinking: max) | Time: 5m 47s | Tokens: 571.8K | Pi SDK v0.80.7 | Action v2.25.1-develop (develop @ e069697)