From 50a295a501aaa5b02ff76965ec67fc58b78673af Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Aug 29 2016 08:01:58 +0000 Subject: Remove downloaded invalid file By using pycurl to download a file from lookaside, invalid content sent back from server is stored into the downloaded file, even if server does not response such as 404. The downloaded file should be removed in order to avoid many confusion to packagers. Fix #79 Signed-off-by: Chenxiong Qi --- diff --git a/src/pyrpkg/lookaside.py b/src/pyrpkg/lookaside.py index f46da65..e257208 100644 --- a/src/pyrpkg/lookaside.py +++ b/src/pyrpkg/lookaside.py @@ -176,6 +176,8 @@ class CGILookasideCache(object): sys.stdout.flush() if status != 200: + self.log.info('Remove downloaded invalid file %s', outfile) + os.remove(outfile) raise DownloadError('Server returned status code %d' % status) os.utime(outfile, (tstamp, tstamp))