From 05e4982245b15aedfc9a0ed5fcf372cca67e9f6f Mon Sep 17 00:00:00 2001 From: Dym Date: Thu, 9 Oct 2025 02:48:17 +0300 Subject: [PATCH] Local API: Resolve 500 error on single item export (#5560) --- chrome/content/zotero/xpcom/server/server_localAPI.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/server/server_localAPI.js b/chrome/content/zotero/xpcom/server/server_localAPI.js index b23621a7c9..a0a66ee538 100644 --- a/chrome/content/zotero/xpcom/server/server_localAPI.js +++ b/chrome/content/zotero/xpcom/server/server_localAPI.js @@ -978,11 +978,14 @@ async function citeprocToHTML(itemOrItems, searchParams, asCitationList) { /** * Export items to a string with the given translator. * - * @param {Zotero.Item[]} items + * @param {Zotero.Item|Zotero.Item[]} itemOrItems * @param {String} translatorID * @returns {Promise} */ -function exportItems(items, translatorID) { +function exportItems(itemOrItems, translatorID) { + let items = Array.isArray(itemOrItems) + ? itemOrItems + : [itemOrItems]; return new Promise((resolve, reject) => { let translation = new Zotero.Translate.Export(); translation.setItems(items.slice());