Skip to content

Commit

Permalink
[users] Fix for having occasional wrong Export failures with decripti…
Browse files Browse the repository at this point in the history
…on that user is missing.
  • Loading branch information
Cookiezaurs committed Mar 14, 2023
1 parent e47a964 commit 0edf92e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/parts/mgmt/app_users.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ usersApi.export = function(app_id, query, params, callback) {
if (single_user === true) {
//update user document
common.db.collection('app_users' + app_id).update({"_id": eid2}, {$set: {"appUserExport": export_folder + ".tar.gz"}}, {upsert: false}, function(err4, res1) {
if (!err4 && res1.result && res1.result.n !== 0 && res1.result.nModified !== 0) {
if (!err4 && res1.result && res1.result.nMatched !== 0) { //check against nMatched for cases when there is already false record of export file(to do not fail)
plugins.dispatch("/systemlogs", {
params: params,
action: "export_app_user",
Expand All @@ -1008,6 +1008,9 @@ usersApi.export = function(app_id, query, params, callback) {
export_folder: export_folder
}
});
if (res1 && res1.result) {
log.e(JSON.stringify(res1.result));
}
callDeleteExport(export_filename, params, app_id, eid, "Exporting failed. User does not exist. Unable to clean exported data", "Exporting failed. User does not exist. Partially exported data deleted.", callback);
}
});
Expand Down

0 comments on commit 0edf92e

Please sign in to comment.