if file is 0 bytes, return false

This commit is contained in:
Matt Venn
2023-04-11 19:02:56 +02:00
parent 7e2bb15658
commit 5bee08714e
+4
View File
@@ -44,6 +44,10 @@ def fetch_file(url, filename):
logging.warning("couldn't download {}".format(url))
return False
if len(r.content) == 0:
logging.warning("file was 0 bytes {}".format(url))
return False
with open(filename, 'wb') as fh:
logging.info("written to {}".format(filename))
fh.write(r.content)