From c903c73270fa60b8ec92fd1fa688d73c8c4d0063 Mon Sep 17 00:00:00 2001 From: niten Date: Tue, 10 Jan 2023 14:10:40 -0800 Subject: [PATCH] Open file in binary mode --- src/objectifier.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objectifier.py b/src/objectifier.py index eadc4b4..02c8eca 100644 --- a/src/objectifier.py +++ b/src/objectifier.py @@ -116,7 +116,7 @@ def analyze_image(request: Request, image: UploadFile): base_url = re.sub(r'\/images\/?$', '/analyzed_images/', str(request.url)) infile = incoming_dir / image.filename file_hash = hashlib.sha256() - with open(infile, "w") as f: + with open(infile, "wb") as f: chunk = image.file.read(buffer_size) while chunk: file_hash.update(chunk)