From c37a52b2bf729e4ec268d719632437f405046929 Mon Sep 17 00:00:00 2001 From: Jack Eilles Date: Wed, 3 Jan 2024 08:51:31 +0000 Subject: [PATCH] fix issue with filesize not being calculated --- app/worker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/worker.py b/app/worker.py index a1882e3..20ea33f 100644 --- a/app/worker.py +++ b/app/worker.py @@ -26,7 +26,9 @@ def uploadFile(file, ip, userid, filename, id, retention): userid = 0 # Calculate retention before the file is written, we'll grab the filesize here as it's needed for the equation. - fileSize = round(float(file.content_length) / 1024, 2) + file.seek(0, os.SEEK_END) + fileSize = round(float(file.tell()) / 1024, 2) + print(fileSize) if retention == None: retention = (Config.minretention+(-Config.maxretention + Config.minretention)*pow((fileSize / Config.maxFileSize -1), 3))