Typo fix (#4290)
Ylian Saint-Hilaire committed
Jul 19, 2022 at 15:46 UTC
2529b35094d284a2b0e202d8474b885c2b6d352a
1 file changed
+3
-3
meshcentral.js
+3
-3
@@ -172,14 +172,14 @@ function CreateMeshCentralServer(config, args) {
172
173
// Fix a NeDB database
174
if (obj.args.dbfix) {
175
- var lines = null, badJsonCount = 0, feildNames = [], fixedDb = [];
175
+ var lines = null, badJsonCount = 0, fieldNames = [], fixedDb = [];
176
try { lines = obj.fs.readFileSync(obj.getConfigFilePath(obj.args.dbfix), { encoding: 'utf8' }).split('\n'); } catch (ex) { console.log('Invalid file: ' + obj.args.dbfix + ': ' + ex); process.exit(); }
177
for (var i = 0; i < lines.length; i++) {
178
var x = null;
179
try { x = JSON.parse(lines[i]); } catch (ex) { badJsonCount++; }
180
- if (x != null) { fixedDb.push(lines[i]); for (var j in x) { if (feildNames.indexOf(j) == -1) { feildNames.push(j); } } }
180
+ if (x != null) { fixedDb.push(lines[i]); for (var j in x) { if (fieldNames.indexOf(j) == -1) { fieldNames.push(j); } } }
181
}
182
- console.log('Lines: ' + lines.length + ', badJSON: ' + badJsonCount + ', Feilds: ' + feildNames);
182
+ console.log('Lines: ' + lines.length + ', badJSON: ' + badJsonCount + ', Feilds: ' + fieldNames);
183
obj.fs.writeFileSync(obj.getConfigFilePath(obj.args.dbfix) + '-fixed', fixedDb.join('\n'), { encoding: 'utf8' });
184
return;
185
}