Fix Zotero.Item.fileExists calling on unsaved item (#4468)

This commit is contained in:
windingwind 2024-07-31 13:19:31 +08:00 committed by GitHub
parent a538a5588e
commit 6530ccd101
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2794,6 +2794,11 @@ Zotero.Item.prototype.fileExists = Zotero.Promise.coroutine(function* () {
if (this.attachmentLinkMode == Zotero.Attachments.LINK_MODE_LINKED_URL) {
throw new Error("Zotero.Item.fileExists() cannot be called on link attachments");
}
// Allow unsaved items to be checked, used by conflict-resolution window
if (!this.key) {
return false;
}
return !!(yield this.getFilePathAsync());
});