From 383a0a36095c7237d331feabcf7cc8e1350e6330 Mon Sep 17 00:00:00 2001 From: German Service Network Date: Sun, 4 Sep 2022 10:56:20 +0200 Subject: [PATCH] Merge github 680036c (raspbmirror.py: verify that files that are expected to exist, actually do.) --- raspbmirror.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/raspbmirror.py b/raspbmirror.py index 5073920..6b00b89 100644 --- a/raspbmirror.py +++ b/raspbmirror.py @@ -146,14 +146,14 @@ def getfile(path,sha256,size): logging.info('existing file '+path.decode('ascii')+' matched by hash and size') fileupdates.add(path) return # no download needed but rename is - elif path in oldknownfiles: - #shortcut exit if file is unchanged, we skip this if a "new" file was detected because - #that means some sort of update was going on to the file and may need to be finished/cleaned up. - oldsha256,oldsize,oldstatus = oldknownfiles[path] - if (oldsha256 == sha256) and (oldsize == size) and (oldstatus != 'F'): - return # no update needed if os.path.isfile(path): # file already exists if (size == os.path.getsize(path)): #no point reading the data and calculating a hash if the size does not match + if path in oldknownfiles: + #shortcut exit if file is unchanged, we skip this if a "new" file was detected because + #that means some sort of update was going on to the file and may need to be finished/cleaned up. + oldsha256,oldsize,oldstatus = oldknownfiles[path] + if (oldsha256 == sha256) and (oldsize == size) and (oldstatus != 'F'): + return # no update needed sha256hashed, tl = getfilesha256andsize(path) if (sha256 == sha256hashed) and (size == tl): logging.info('existing file '+path.decode('ascii')+' matched by hash and size') -- 2.43.0