Fix a /saveItems session management race condition bug
This commit is contained in:
parent
a24cada451
commit
90a70f7c31
2 changed files with 5 additions and 4 deletions
|
@ -742,9 +742,10 @@ Zotero.Server.Connector.SaveItems.prototype = {
|
|||
session,
|
||||
targetID,
|
||||
requestData,
|
||||
function (topLevelItems) {
|
||||
function (jsonItems, items) {
|
||||
session.addItems(items);
|
||||
// Only return the properties the connector needs
|
||||
topLevelItems = topLevelItems.map((item) => {
|
||||
jsonItems = jsonItems.map((item) => {
|
||||
let o = {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
|
@ -764,7 +765,7 @@ Zotero.Server.Connector.SaveItems.prototype = {
|
|||
};
|
||||
return o;
|
||||
});
|
||||
resolve([201, "application/json", JSON.stringify({items: topLevelItems})]);
|
||||
resolve([201, "application/json", JSON.stringify({items: jsonItems})]);
|
||||
}
|
||||
)
|
||||
// Add items to session once all attachments have been saved
|
||||
|
|
|
@ -179,7 +179,7 @@ Zotero.Translate.ItemSaver.prototype = {
|
|||
}.bind(this));
|
||||
|
||||
if (itemsDoneCallback) {
|
||||
itemsDoneCallback(items.map(item => jsonByItem.get(item)));
|
||||
itemsDoneCallback(items.map(item => jsonByItem.get(item)), items);
|
||||
}
|
||||
|
||||
// Save standalone attachments
|
||||
|
|
Loading…
Add table
Reference in a new issue