Skip to content

Fix : Notion zip import flattened attachment and file renaming when case insensitively duplicates#522

Open
BisonLeo wants to merge 3 commits intoobsidianmd:masterfrom
BisonLeo:master
Open

Fix : Notion zip import flattened attachment and file renaming when case insensitively duplicates#522
BisonLeo wants to merge 3 commits intoobsidianmd:masterfrom
BisonLeo:master

Conversation

@BisonLeo
Copy link
Copy Markdown

Fix 1:
Notion: Fix case-insensitive filename collisions on Windows/macOS

On case-insensitive filesystems, "Getting started.md" and "Getting
Started.md" collide. The dedup logic only checked case-sensitively,
so both files would attempt to create the same path.

For notes: detect case-insensitive collisions and rename the second
file by appending _<first4ofNotionID> (e.g. "Getting Started_6ec2.md"),
keeping wikilinks correct since the title is updated before link
generation.

For attachments: use a parallel lowercase Set for O(1) collision
checks instead of case-sensitive Set.has().

Fix 2:
Show full paths in error/skip messages for easier debugging

The import UI truncated file names and error reasons to 100 chars,
making "File already exists" errors impossible to act on. Now the
full untruncated text is available as a tooltip on hover. Also
include the target vault path in Notion import errors so users can
see which output file caused the collision.

Fix 3:
Notion: Fix attachment flattening and use relative paths in wikilinks

Attachments from Notion zip exports were all placed in a single folder,
causing filename collisions (e.g. p1/1.png and p2/1.png). Wikilinks
used bare filenames (![[1.png]]) instead of paths relative to the note.

- Add getRelativePath() to compute ./relative/path from note to attachment
- Preserve subfolder structure in cleanDuplicateAttachments for all
  attachment folder modes (not just ./ current-folder mode)
- Thread noteDir through readToMarkdown → convertLinksToObsidian so
  attachment links render as ![[./Attachment Tests/file.jpg]]
- Add standalone test script for path resolution verification
- Add CLAUDE.md with architecture docs and known bug analysis

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

BisonLeo and others added 3 commits March 26, 2026 22:03
Attachments from Notion zip exports were all placed in a single folder,
causing filename collisions (e.g. p1/1.png and p2/1.png). Wikilinks
used bare filenames (![[1.png]]) instead of paths relative to the note.

- Add getRelativePath() to compute ./relative/path from note to attachment
- Preserve subfolder structure in cleanDuplicateAttachments for all
  attachment folder modes (not just ./ current-folder mode)
- Thread noteDir through readToMarkdown → convertLinksToObsidian so
  attachment links render as ![[./Attachment Tests/file.jpg]]
- Add standalone test script for path resolution verification
- Add CLAUDE.md with architecture docs and known bug analysis

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The import UI truncated file names and error reasons to 100 chars,
making "File already exists" errors impossible to act on. Now the
full untruncated text is available as a tooltip on hover. Also
include the target vault path in Notion import errors so users can
see which output file caused the collision.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On case-insensitive filesystems, "Getting started.md" and "Getting
Started.md" collide. The dedup logic only checked case-sensitively,
so both files would attempt to create the same path.

For notes: detect case-insensitive collisions and rename the second
file by appending _<first4ofNotionID> (e.g. "Getting Started_6ec2.md"),
keeping wikilinks correct since the title is updated before link
generation.

For attachments: use a parallel lowercase Set for O(1) collision
checks instead of case-sensitive Set.has().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant