fix mysql autoback zippassword
Signed-off-by: Simon Smith <simonsmith5521@gmail.com>
Simon Smith committed
Aug 15, 2024 at 13:06 UTC
c1e3354c918516b4777a46e7ed04b126423203b3
1 file changed
+10
-6
db.js
+10
-6
@@ -3426,13 +3426,17 @@ module.exports.CreateDB = function (parent, func) {
3426
var archiver = require('archiver');
3427
var output = parent.fs.createWriteStream(newAutoBackupPath + '.zip');
3428
var archive = null;
3429
- try {
3430
- archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted'));
3431
- archive = archiver.create('zip-encrypted', { zlib: { level: 9 }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword });
3432
- if (func) { func('Creating encrypted ZIP'); }
3433
- } catch (ex) { // registering encryption failed, so create without encryption
3429
+ if (parent.config.settings.autobackup && (typeof parent.config.settings.autobackup.zippassword == 'string')) {
3430
+ try {
3431
+ archiver.registerFormat('zip-encrypted', require('archiver-zip-encrypted'));
3432
+ archive = archiver.create('zip-encrypted', { zlib: { level: 9 }, encryptionMethod: 'aes256', password: parent.config.settings.autobackup.zippassword });
3433
+ if (func) { func('Creating encrypted ZIP'); }
3434
+ } catch (ex) { // registering encryption failed, so create without encryption
3435
+ archive = archiver('zip', { zlib: { level: 9 } });
3436
+ if (func) { func('Creating encrypted ZIP failed, so falling back to normal ZIP'); }
3437
+ }
3438
+ } else {
3439
archive = archiver('zip', { zlib: { level: 9 } });
3435
- if (func) { func('Creating encrypted ZIP failed, so falling back to normal ZIP'); }
3440
}
3441
output.on('close', function () {
3442
obj.performingBackup = false;