check from final size instead of partials

This commit is contained in:
Victor Shyba 2019-07-23 15:26:43 -03:00 committed by Lex Berezhny
parent 8a69ec062e
commit 6f5a595975

View file

@ -138,10 +138,10 @@ class HeadersComponent(Component):
if response.status == 406 or response.content_length < self.headers.header_size: # our file is bigger if response.status == 406 or response.content_length < self.headers.header_size: # our file is bigger
log.warning("s3 is more out of date than we are") log.warning("s3 is more out of date than we are")
return return
if response.content_length % self.headers.header_size != 0: final_size_after_download = response.content_length + local_header_size
if final_size_after_download % self.headers.header_size != 0:
log.warning("s3 appears to have corrupted header") log.warning("s3 appears to have corrupted header")
return return
final_size_after_download = response.content_length + local_header_size
write_mode = "wb" write_mode = "wb"
if local_header_size > 0: if local_header_size > 0:
log.info("Resuming download of %i bytes from s3", response.content_length) log.info("Resuming download of %i bytes from s3", response.content_length)