diff --git a/js/backup_restore.js b/js/backup_restore.js index 7141e5d191..dfd9922bc3 100644 --- a/js/backup_restore.js +++ b/js/backup_restore.js @@ -70,7 +70,16 @@ function configuration_backup() { console.error(e); }; + var truncated = false; writer.onwriteend = function() { + if (!truncated) { + // onwriteend will be fired again when truncation is finished + truncated = true; + writer.truncate(serialized_config_object.length); + + return; + } + console.log('Write SUCCESSFUL'); };