From 3231e24bd53e0524475ffbb57998a408e2506d6c Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Thu, 20 Jun 2024 13:20:09 -0400 Subject: [PATCH] Local API: Use getByLibraryAndKeyAsync() --- chrome/content/zotero/xpcom/localAPI/server_localAPI.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/localAPI/server_localAPI.js b/chrome/content/zotero/xpcom/localAPI/server_localAPI.js index 8063adc8f8..2ddd9bd93b 100644 --- a/chrome/content/zotero/xpcom/localAPI/server_localAPI.js +++ b/chrome/content/zotero/xpcom/localAPI/server_localAPI.js @@ -708,8 +708,8 @@ Zotero.Server.Endpoints["/api/groups/:groupID/searches/:searchKey/items"] = Zote Zotero.Server.LocalAPI.Item = class extends LocalAPIEndpoint { supportedMethods = ['GET']; - run({ pathParams, libraryID }) { - let item = Zotero.Items.getByLibraryAndKey(libraryID, pathParams.itemKey); + async run({ pathParams, libraryID }) { + let item = await Zotero.Items.getByLibraryAndKeyAsync(libraryID, pathParams.itemKey); if (!item) return _404; return { data: item }; } @@ -721,8 +721,8 @@ Zotero.Server.Endpoints["/api/groups/:groupID/items/:itemKey"] = Zotero.Server.L Zotero.Server.LocalAPI.ItemFile = class extends LocalAPIEndpoint { supportedMethods = ['GET']; - run({ pathname, pathParams, libraryID }) { - let item = Zotero.Items.getByLibraryAndKey(libraryID, pathParams.itemKey); + async run({ pathname, pathParams, libraryID }) { + let item = await Zotero.Items.getByLibraryAndKeyAsync(libraryID, pathParams.itemKey); if (!item) return _404; if (!item.isFileAttachment()) { return [400, 'text/plain', `Not a file attachment: ${item.key}`];