Skip to content

Commit

Permalink
Merge branch 'abderrahim/etag' into 'master'
Browse files Browse the repository at this point in the history
_downloadablefilesource.py: don't download the file if etag matches

See merge request BuildStream/buildstream!1833
  • Loading branch information
abderrahim committed Mar 24, 2020
2 parents 341940a + 605b5fb commit aec9deb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/buildstream/plugins/sources/_downloadablefilesource.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ def _ensure_mirror(self):
with contextlib.closing(opener.open(request)) as response:
info = response.info()

etag = info["ETag"] if "ETag" in info else None
# some servers don't honor the 'If-None-Match' header
if self.ref and etag and info["ETag"] == etag:
return self.ref

etag = info["ETag"]

filename = info.get_filename(default_name)
filename = os.path.basename(filename)
Expand Down

0 comments on commit aec9deb

Please sign in to comment.