Unlink on backup interruption
This commit is contained in:
parent
7548e2adc2
commit
c0050890a9
1 changed files with 10 additions and 1 deletions
|
@ -475,8 +475,14 @@ export class BackupsService {
|
||||||
|
|
||||||
this.downloadController = undefined;
|
this.downloadController = undefined;
|
||||||
|
|
||||||
// Too late to cancel now
|
|
||||||
try {
|
try {
|
||||||
|
// Too late to cancel now, make sure we are unlinked if the process
|
||||||
|
// is aborted due to error or restart.
|
||||||
|
const password = window.storage.get('password');
|
||||||
|
strictAssert(password != null, 'Must be registered to import backup');
|
||||||
|
|
||||||
|
await window.storage.remove('password');
|
||||||
|
|
||||||
await this.importFromDisk(downloadPath, {
|
await this.importFromDisk(downloadPath, {
|
||||||
ephemeralKey,
|
ephemeralKey,
|
||||||
onProgress: (currentBytes, totalBytes) => {
|
onProgress: (currentBytes, totalBytes) => {
|
||||||
|
@ -487,6 +493,9 @@ export class BackupsService {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Restore password on success
|
||||||
|
await window.storage.put('password', password);
|
||||||
} finally {
|
} finally {
|
||||||
await unlink(downloadPath);
|
await unlink(downloadPath);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue