Added missing unlink on error

This commit is contained in:
RemixDev 2021-06-29 01:11:13 +02:00
parent f530a4e89f
commit d8ecb244f5
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
2 changed files with 2 additions and 0 deletions

1
.gitignore vendored
View File

@ -28,6 +28,7 @@ yarn-error.log*
# Private configs # Private configs
/config.py /config.py
/test.py /test.py
/config/
#build files #build files
/build /build

View File

@ -329,6 +329,7 @@ class Downloader:
with open(writepath, 'wb') as stream: with open(writepath, 'wb') as stream:
streamTrack(stream, track, downloadObject=self.downloadObject, listener=self.listener) streamTrack(stream, track, downloadObject=self.downloadObject, listener=self.listener)
except requests.exceptions.HTTPError as e: except requests.exceptions.HTTPError as e:
if writepath.is_file(): writepath.unlink()
raise DownloadFailed('notAvailable', track) from e raise DownloadFailed('notAvailable', track) from e
except OSError as e: except OSError as e:
if writepath.is_file(): writepath.unlink() if writepath.is_file(): writepath.unlink()