Skip to content

fix(export): never emit punctuation-only Obsidian filenames (e.g. @.md)#1410

Closed
Mylock51 wants to merge 1 commit into
Graphify-Labs:v8from
Mylock51:fix/punctuation-only-filenames
Closed

fix(export): never emit punctuation-only Obsidian filenames (e.g. @.md)#1410
Mylock51 wants to merge 1 commit into
Graphify-Labs:v8from
Mylock51:fix/punctuation-only-filenames

Conversation

@Mylock51

Copy link
Copy Markdown

Fixes #1409.

Problem

to_obsidian()'s safe_name() can produce a punctuation-only filename (e.g. @.md) when a node label is all-punctuation after the unsafe-char strip — e.g. a @/* node from a tsconfig.json paths key leaves a bare @, which is truthy and so slips past the else "unnamed" fallback.

The file is valid on disk but empty once a downstream tool re-slugs the stem on word chars. In particular it crashes qmd update (handelize() reduces @"" and raises), and because qmd indexes collections in a batch, that one generated file aborts reindexing for every collection on the machine.

Fix

Require at least one \w char in the stem; otherwise fall back to "unnamed". Applied to both safe_name occurrences (node export + community export). The existing dedup logic already disambiguates multiple unnamed collisions.

Behavior is unchanged for any label containing a word char (@types/node@typesnode.md as before); only the pathological all-punctuation case changes.

🤖 Generated with Claude Code

An all-punctuation node label (e.g. `@/*` from a tsconfig paths entry) survived
the unsafe-char strip in `to_obsidian`'s `safe_name()` as a bare `@`, producing
`@.md`. That filename is valid on disk but empty once a downstream tool re-slugs
on word chars — qmd's handelize() reduces "@" -> "" and raises, aborting the
entire `qmd update` (every collection on the machine stops reindexing).

Require at least one word char in the stem; otherwise fall back to "unnamed"
(the existing dedup handles collisions). Applied to both safe_name occurrences.

Fixes Graphify-Labs#1409

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
safishamsi added a commit that referenced this pull request Jun 22, 2026
…1409)

Cover the #1410 fix: to_obsidian and to_canvas must never emit a punctuation-only
filename (e.g. `@.md` from a `@/*` tsconfig paths key) — valid on disk but empty
once a downstream tool re-slugs on word chars (crashes `qmd update`). Both tests
exercise the public exporters and fail against the pre-fix safe_name().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@safishamsi

Copy link
Copy Markdown
Collaborator

Merged into v8 as 30cc4c0 (cherry-picked onto current v8), with a regression test added in 739230e. Verified the fix is multilingual-safe (\w is unicode-aware, so café/日本語 labels are preserved) and the tests fail against the pre-fix safe_name(). Full suite green on 3.10 + 3.12; smoke confirms a @/* node now writes unnamed.md, never @.md. Thanks @Mylock51!

@safishamsi safishamsi closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

to_obsidian: all-punctuation labels emit punctuation-only filenames (e.g. @.md) that break downstream slug/indexers (qmd handelize crash)

2 participants