Skip to content

fix(ignore-pattern): match note path and vault file path - #27

Merged
ClaudiaFang merged 1 commit into
refactor/settings-ux-overhaulfrom
fix/ignore-pattern-note-and-file-path
Sep 3, 2026
Merged

ClaudiaFang merged 1 commit into
refactor/settings-ux-overhaulfrom
fix/ignore-pattern-note-and-file-path

Conversation

@ClaudiaFang

Copy link
Copy Markdown
Member

Summary

  • ignorePattern previously only ever checked the currently active Markdown note (shouldIgnoreCurrentFile()), which was wrong for auto-upload-on-create: it checked whichever note happened to be open, not the newly created attachment's path.
  • Add a single pure helper matchesIgnorePattern(pattern, { notePath, filePath }) (in src/ignorePattern.ts), used by both pasteHandler and main.ts's auto-upload-on-create path, replacing the duplicated minimatch calls and the removed zero-argument shouldIgnore()/shouldIgnoreCurrentFile() APIs.
  • An upload is now ignored if the pattern matches either the relevant note path or the source vault file path — never the generated S3 object key.
  • Updated the "Ignore pattern" setting description to document this, and that ignored paste/drop falls back to normal Obsidian handling.
  • No unrelated settings/IA/provider changes.

Test plan

  • npm run lint
  • npm run build (tsc -noEmit + esbuild)
  • npm test — 111 tests passing, including new tests/ignorePattern.test.ts, tests/autoUploadIgnore.test.ts, and ignore-behavior additions to tests/pasteHandler.test.ts
  • Regression test for the reported failure: active note Notes/foo.md, created Private/image.png, pattern Private/** → auto-upload is skipped

🤖 Generated with Claude Code

https://claude.ai/code/session_01Uj2kZV1XMWSqnNqvVYyjn7

…tive note

ignorePattern previously only checked the currently active Markdown note
via shouldIgnoreCurrentFile(), which was wrong for auto-upload-on-create:
it checked whichever note happened to be open instead of the newly
created attachment's path, so a pattern like "Private/**" would not
reliably skip a matching created file.

Add a single pure helper, matchesIgnorePattern(pattern, {notePath,
filePath}), used by both pasteHandler and main's auto-upload-on-create
path, replacing the duplicated minimatch call and the removed
shouldIgnore()/shouldIgnoreCurrentFile() zero-argument APIs. An upload is
now ignored if the pattern matches either the relevant note path or the
source vault file path (never the generated S3 object key). Update the
"Ignore pattern" setting description to document this.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uj2kZV1XMWSqnNqvVYyjn7
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
14.6% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@ClaudiaFang
ClaudiaFang marked this pull request as ready for review September 3, 2026 08:15
@ClaudiaFang
ClaudiaFang merged commit 9975a25 into refactor/settings-ux-overhaul Sep 3, 2026
12 of 13 checks passed
@ClaudiaFang
ClaudiaFang deleted the fix/ignore-pattern-note-and-file-path branch September 3, 2026 08:15
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