From 28a8734e3a21537f5b80ea7abc124ab7e639deb8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 20 2018 15:36:04 +0000 Subject: Re-generate the sha for every file. Basically, we were instantiating the sha outside of the loop going through the files. This meant that if we generated the sha for two files, the sha of the second included the first one in it... This commit fixes this be making sure we compute a new sha specific for each file. Fixes https://pagure.io/pagure/issue/3448 Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/lib/tasks.py b/pagure/lib/tasks.py index 583f0ca..e152711 100644 --- a/pagure/lib/tasks.py +++ b/pagure/lib/tasks.py @@ -795,12 +795,11 @@ def update_checksums_file(self, session, folder, filenames): # This wasn't generated by pagure, don't touch it! return - algos = { - 'sha256': hashlib.sha256(), - 'sha512': hashlib.sha512(), - } - for filename in filenames: + algos = { + 'sha256': hashlib.sha256(), + 'sha512': hashlib.sha512(), + } # for each files computes the different algorythm supported with open(os.path.join(folder, filename), "rb") as stream: while True: