diff --git a/chrome/content/zotero/renameFiles.mjs b/chrome/content/zotero/renameFiles.mjs index cedc0f1124..871ea06b8d 100644 --- a/chrome/content/zotero/renameFiles.mjs +++ b/chrome/content/zotero/renameFiles.mjs @@ -285,6 +285,7 @@ export function registerAutoRenameFileFromParent() { } } + await attachmentItem.loadDataType('itemData'); let previousMetadataBaseName = Zotero.Attachments.getFileBaseNameFromItem( parentItemBefore, { attachmentTitle: attachmentItem.getField('title') } ); diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index a7f6e97e3f..228c9062ed 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3921,7 +3921,7 @@ Zotero.Item.prototype.getBestAttachments = async function () { + "AND IA.itemID NOT IN (SELECT itemID FROM deletedItems) " + "ORDER BY contentType='application/pdf' DESC, value=? DESC, dateAdded ASC"; var itemIDs = await Zotero.DB.columnQueryAsync(sql, [this.id, url]); - return this.ObjectsClass.get(itemIDs); + return await this.ObjectsClass.getAsync(itemIDs); };