diff options
-rw-r--r-- | buildstream/plugins/sources/_downloadablefilesource.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/buildstream/plugins/sources/_downloadablefilesource.py b/buildstream/plugins/sources/_downloadablefilesource.py index b4c7582fc..ab8140de0 100644 --- a/buildstream/plugins/sources/_downloadablefilesource.py +++ b/buildstream/plugins/sources/_downloadablefilesource.py @@ -121,7 +121,11 @@ class DownloadableFileSource(Source): with contextlib.closing(urllib.request.urlopen(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) |