]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
location(8): Remove any temporary files after unsuccessful downloads
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 10 Jul 2020 14:47:54 +0000 (16:47 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Fri, 10 Jul 2020 14:47:54 +0000 (16:47 +0200)
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
src/python/downloader.py

index 5caad5188a4502b44a526638ca44135c1efe70cc..87bbb685043677f6a4a21689abd3c34aa3ce6295 100644 (file)
@@ -180,6 +180,9 @@ class Downloader(object):
                                        # Return temporary file
                                        return t
 
+               # Delete the temporary file after unsuccessful downloads
+               os.unlink(t.name)
+
                raise FileNotFoundError(url)
 
        def _check_database(self, f, public_key, timestamp=None):