From d33346b11dc77bcd405fae78f4493ac6f68720e6 Mon Sep 17 00:00:00 2001 From: Isaac Grynsztein Date: Thu, 26 Mar 2020 10:47:56 -0400 Subject: [PATCH] Final fix for bug where failed downloads still appeared in the multi download menu --- src/app/main/main.component.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/app/main/main.component.ts b/src/app/main/main.component.ts index 9df19d6..c7ed2b8 100644 --- a/src/app/main/main.component.ts +++ b/src/app/main/main.component.ts @@ -595,10 +595,15 @@ export class MainComponent implements OnInit { if (this.path !== '-1') { this.downloadHelperMp3(this.path, is_playlist, false, new_download); } - }, error => { // can't access server + }, error => { // can't access server or failed to download for other reasons this.downloadingfile = false; this.current_download = null; new_download['downloading'] = false; + // removes download from list of downloads + const downloads_index = this.downloads.indexOf(new_download); + if (downloads_index !== -1) { + this.downloads.splice(downloads_index) + } this.openSnackBar('Download failed!', 'OK.'); }); } else { @@ -633,6 +638,11 @@ export class MainComponent implements OnInit { this.downloadingfile = false; this.current_download = null; new_download['downloading'] = false; + // removes download from list of downloads + const downloads_index = this.downloads.indexOf(new_download); + if (downloads_index !== -1) { + this.downloads.splice(downloads_index) + } this.openSnackBar('Download failed!', 'OK.'); }); }