Local API: Use getByLibraryAndKeyAsync()
This commit is contained in:
parent
3f45def928
commit
3231e24bd5
1 changed files with 4 additions and 4 deletions
|
@ -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}`];
|
||||
|
|
Loading…
Reference in a new issue