Local API: Resolve 500 error on single item export (#5560)

This commit is contained in:
Dym 2025-10-09 02:48:17 +03:00 • committed by GitHub
parent 2e3deb0a21
commit 05e4982245
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<String>}
*/
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());