From dadb4b4eb68a1af967611adbd08fdc2db599e06e Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sat, 17 Oct 2020 17:07:32 +0200 Subject: [PATCH] Do not recalculate the md5 sum in case of chunk re-uploads --- pyrogram/methods/advanced/save_file.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyrogram/methods/advanced/save_file.py b/pyrogram/methods/advanced/save_file.py index e9727951..a74c388c 100644 --- a/pyrogram/methods/advanced/save_file.py +++ b/pyrogram/methods/advanced/save_file.py @@ -154,7 +154,7 @@ class SaveFile(Scaffold): chunk = fp.read(part_size) if not chunk: - if not is_big: + if not is_big and not is_missing_part: md5_sum = "".join([hex(i)[2:].zfill(2) for i in md5_sum.digest()]) break @@ -177,7 +177,7 @@ class SaveFile(Scaffold): if is_missing_part: return - if not is_big: + if not is_big and not is_missing_part: md5_sum.update(chunk) file_part += 1