Skip to content

Commit

Permalink
Merge attachments and update notes (#2336)
Browse files Browse the repository at this point in the history
We follow a different merge procedure for each attachment type:

- For PDF attachments, compare by MD5. If no match, get the top 50 words
  in the attachment's text and hash those, then check again for a match.
  Update references to item keys in notes and annotations.
- For web (snapshot / link) attachments, compare by title and URL.
  Prefer a title + URL match but accept a title-only match.
- For other attachment types, keep all attachments from all items being
  merged.

Also:

- Move most merge tests from Duplicates to Items#merge(). It just doesn't
  make sense to worry about the UI in these.
  • Loading branch information
AbeJellinek committed Mar 9, 2022
1 parent 8e8b03e commit ef82bec
Show file tree
Hide file tree
Showing 13 changed files with 753 additions and 95 deletions.
2 changes: 1 addition & 1 deletion chrome/content/zotero/xpcom/data/item.js
Expand Up @@ -2916,7 +2916,7 @@ Zotero.Item.prototype.deleteAttachmentFile = Zotero.Promise.coroutine(function*
* Return a file:/// URL path to files and snapshots
*/
Zotero.Item.prototype.getLocalFileURL = function() {
if (!this.isAttachment) {
if (!this.isAttachment()) {
throw ("getLocalFileURL() can only be called on attachment items");
}

Expand Down

0 comments on commit ef82bec

Please sign in to comment.