Skip to content

Bug: Content silently truncated at ampersand (&) characters in --content flag #107

@Raleighawesome

Description

@Raleighawesome

Description

The create command silently truncates content at the first & character when using the --content flag. Exit code is 0, but only content before the & is written to the note.

Version

obsidian-cli v0.2.2 (installed via Homebrew on macOS ARM64)

Steps to Reproduce

obsidian-cli create "test-ampersand" \
  --vault "MyVault" \
  --content "line 1
line 2
line 3 & line 3 continued
line 4
line 5" \
  --overwrite

Expected Result

Note contains all 5 lines:

line 1
line 2
line 3 & line 3 continued
line 4
line 5

Actual Result

Note contains only:

line 1
line 2
line 3

Everything after the & is silently dropped. Exit code is 0.

Root Cause

The & character is not being percent-encoded before being passed to the obsidian:// URI handler. The URI scheme interprets & as a parameter delimiter, so the content parameter ends at the first unencoded &.

This also affects #, =, and other URI-significant characters.

Impact

Any real-world markdown content with ampersands (e.g., "Terms & Conditions", "R&D", currency formatting, HTML entities) will be silently truncated. The silent failure (exit code 0, no error message) makes this especially dangerous since users have no indication their content was incomplete.

Workaround

Write directly to the vault filesystem instead of using obsidian-cli create. Obsidian picks up file changes via its sync watcher.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions