Skip to content

Fix pinned item duplication on clipboard re-read - #3480

Merged
hluk merged 1 commit into
masterfrom
fix/pinned-item-duplication
Mar 16, 2026
Merged

hluk merged 1 commit into
masterfrom
fix/pinned-item-duplication

Conversation

@hluk

@hluk hluk commented Mar 14, 2026

Copy link
Copy Markdown
Owner

When a pinned item is activated, its data (including the application/x-copyq-item-pinned metadata format) is placed on the system clipboard. When clipboard ownership is later lost and the monitor re-reads the clipboard, the data no longer contains mimePinned. The hash function did not treat item metadata formats (item-pinned, item-notes) as plugin formats, so the hash of the re-read data differed from the stored item hash, causing addUnique() to create a duplicate.

Fix by widening isPluginFormat() to include all formats starting with the plugin prefix ("application/x-copyq-item"), not just those without a dash after "item". This makes hash() skip item metadata formats, so duplicate detection works regardless of whether mimePinned is present.

Fixes: #3131
Fixes: #3042
Assisted-by: Claude (Anthropic)

When a pinned item is activated, its data (including the
application/x-copyq-item-pinned metadata format) is placed on the system
clipboard. When clipboard ownership is later lost and the monitor re-reads
the clipboard, the data no longer contains mimePinned. The hash function
did not treat item metadata formats (item-pinned, item-notes) as plugin
formats, so the hash of the re-read data differed from the stored item
hash, causing addUnique() to create a duplicate.

Fix by widening isPluginFormat() to include all formats starting with the
plugin prefix ("application/x-copyq-item"), not just those without a dash
after "item". This makes hash() skip item metadata formats, so duplicate
detection works regardless of whether mimePinned is present.

Fixes: #3131
Fixes: #3042
Assisted-by: Claude (Anthropic)
@codecov

codecov Bot commented Mar 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.44%. Comparing base (de7b90e) to head (0b7040d).
⚠️ Report is 135 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3480      +/-   ##
==========================================
+ Coverage   80.32%   80.44%   +0.11%     
==========================================
  Files         243      243              
  Lines       30637    30658      +21     
==========================================
+ Hits        24610    24663      +53     
+ Misses       6027     5995      -32     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hluk
hluk merged commit d10fe4e into master Mar 16, 2026
14 checks passed
@hluk
hluk deleted the fix/pinned-item-duplication branch March 20, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant