Include information about saved snapshots in /saveSnapshot

This commit is contained in:
Adomas Venčkauskas 2023-07-11 15:45:51 +03:00
parent 5928147f26
commit 02ba9ca7f0

View file

@ -1128,7 +1128,7 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
} }
try { try {
let item = await this.saveSnapshot(targetID, requestData); var item = await this.saveSnapshot(targetID, requestData);
await session.addItem(item); await session.addItem(item);
} }
catch (e) { catch (e) {
@ -1136,9 +1136,15 @@ Zotero.Server.Connector.SaveSnapshot.prototype = {
return 500; return 500;
} }
let attachments = [];
let hasAttachments = item.getAttachments().length;
if (hasAttachments) {
attachments = [{mimeType: "text/html", title: data.title, url: data.url}];
}
return [201, return [201,
"application/json", "application/json",
JSON.stringify({ saveSingleFile: !data.skipSnapshot && !data.pdf })]; JSON.stringify({ saveSingleFile: !data.skipSnapshot && !data.pdf && data.singleFile, attachments })];
}, },
/* /*