From d8ecb244f55fa53f9a0fc76de7874c88a434a5c6 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Tue, 29 Jun 2021 01:11:13 +0200 Subject: [PATCH] Added missing unlink on error --- .gitignore | 1 + deemix/downloader.py | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 3a64c4a..91c6caf 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ yarn-error.log* # Private configs /config.py /test.py +/config/ #build files /build diff --git a/deemix/downloader.py b/deemix/downloader.py index a9c7247..0c960de 100644 --- a/deemix/downloader.py +++ b/deemix/downloader.py @@ -329,6 +329,7 @@ class Downloader: with open(writepath, 'wb') as stream: streamTrack(stream, track, downloadObject=self.downloadObject, listener=self.listener) except requests.exceptions.HTTPError as e: + if writepath.is_file(): writepath.unlink() raise DownloadFailed('notAvailable', track) from e except OSError as e: if writepath.is_file(): writepath.unlink()