From 0b84068d84d9c5d811044c63d9a3370d75aa0249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 18 Jan 2020 00:30:57 +0100 Subject: [PATCH] remove temp files before downloading from fallback URLs otherwise the next call to download() with a fallback URL could see the partially downloaded "remains" from the previous, failed download attempt and "continue" it, writing the second half of a potentially different version of that file. --- gallery_dl/job.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 699f057a..5779d65c 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright 2015-2019 Mike Fährmann +# Copyright 2015-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as @@ -209,6 +209,7 @@ class DownloadJob(Job): # use fallback URLs if available for num, url in enumerate(fallback or (), 1): + util.remove_file(self.temppath) self.log.info("Trying fallback URL #%d", num) if self.download(url): break