Fixed server exception, #4030

This commit is contained in:
Ylian Saint-Hilaire 2022-05-23 11:24:28 -07:00
parent fe3ee25054
commit 7b364d48b0
1 changed files with 6 additions and 4 deletions

View File

@ -7274,10 +7274,12 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
function readFilesRec(path) {
var r = {}, dir = fs.readdirSync(path);
for (var i in dir) {
var f = { t: 3, d: 111 };
var stat = fs.statSync(path + '/' + dir[i]);
if ((stat.mode & 0x004000) == 0) { f.s = stat.size; f.d = stat.mtime.getTime(); } else { f.t = 2; f.f = readFilesRec(path + '/' + dir[i]); }
r[dir[i]] = f;
var f = { t: 3, d: 111 }, stat = null;
try { stat = fs.statSync(path + '/' + dir[i]); } catch (ex) { }
if (stat != null) {
if ((stat.mode & 0x004000) == 0) { f.s = stat.size; f.d = stat.mtime.getTime(); } else { f.t = 2; f.f = readFilesRec(path + '/' + dir[i]); }
r[dir[i]] = f;
}
}
return r;
}