Skip items in save session that no longer exist
Ideally I guess the entry would be removed from the save popup in the connector and a second button click would do a fresh save rather than reopening the popup, but for now just avoid an error. Addresses zotero/zotero-connectors#220
This commit is contained in:
parent
a4aabd9f3e
commit
9b9773db16
|
@ -200,6 +200,10 @@ Zotero.Server.Connector.SaveSession.prototype._updateObjects = async function (o
|
||||||
// a child item (e.g., from Retrieve Metadata for PDF)
|
// a child item (e.g., from Retrieve Metadata for PDF)
|
||||||
if (objectType == 'item') {
|
if (objectType == 'item') {
|
||||||
let item = object.isTopLevelItem() ? object : object.parentItem;
|
let item = object.isTopLevelItem() ? object : object.parentItem;
|
||||||
|
if (!Zotero.Items.exists(item.id)) {
|
||||||
|
Zotero.debug(`Item ${item.id} in save session no longer exists`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Keep automatic tags
|
// Keep automatic tags
|
||||||
let originalTags = item.getTags().filter(tag => tag.type == 1);
|
let originalTags = item.getTags().filter(tag => tag.type == 1);
|
||||||
item.setTags(originalTags.concat(tags));
|
item.setTags(originalTags.concat(tags));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user