Skip unnecessary SQL query if no attachments in Item#getBestAttachments()

This probably shouldn't be SQL at all, but while it is, skip it if not
necessary.
This commit is contained in:
Dan Stillman 2025-08-22 03:33:09 -04:00
parent 2216729721
commit 5c6400e21b

View file

@ -3862,6 +3862,10 @@ Zotero.Item.prototype.getBestAttachments = async function () {
throw new Error("getBestAttachments() can only be called on regular items");
}
if (!this.numAttachments()) {
return [];
}
var url = this.getField('url');
var urlFieldID = Zotero.ItemFields.getID('url');