forgejo/inject-pr-samples: properly flush and close injected sample before hashing

This commit is contained in:
Timo Rothenpieler committed 2026-08-31 18:09:20 +00:00
1 parent 486f03997c
commit 4efbbd1543
1 file changed
+1
+1
View File
@@ -109,6 +109,7 @@ def download(url, dst):
with urllib.request.urlopen(url) as r:
while chunk := r.read(1 << 16):
tmp.write(chunk)
tmp.close()
if dst.exists() and digest(dst) != digest(tmp_path):
raise ValueError(f"already exists with different content: {dst}")
tmp_path.rename(dst)