From 0edf92e7f5b94ff37dbe6d4335a3753554faef01 Mon Sep 17 00:00:00 2001 From: Cookiezaurs Date: Tue, 14 Mar 2023 18:15:04 +0200 Subject: [PATCH] [users] Fix for having occasional wrong Export failures with decription that user is missing. --- api/parts/mgmt/app_users.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/parts/mgmt/app_users.js b/api/parts/mgmt/app_users.js index b24a09e7513..7e99183b211 100644 --- a/api/parts/mgmt/app_users.js +++ b/api/parts/mgmt/app_users.js @@ -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", @@ -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); } });