summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildstream/plugins/sources/_downloadablefilesource.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/buildstream/plugins/sources/_downloadablefilesource.py b/src/buildstream/plugins/sources/_downloadablefilesource.py
index 50f8561fb..ad8fe9f22 100644
--- a/src/buildstream/plugins/sources/_downloadablefilesource.py
+++ b/src/buildstream/plugins/sources/_downloadablefilesource.py
@@ -178,7 +178,11 @@ class DownloadableFileSource(Source):
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)