From a5100b18d9a0af2ff2e5a54a1270d0f78357ed0d Mon Sep 17 00:00:00 2001 From: Safwan Samsudeen Date: Thu, 12 Mar 2026 13:51:24 +0530 Subject: [PATCH] fix: make file size param optional --- frappe/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/handler.py b/frappe/handler.py index f9315d5aab..fb89799360 100644 --- a/frappe/handler.py +++ b/frappe/handler.py @@ -165,7 +165,6 @@ def upload_file(): file = files["file"] filename = file.filename - total_file_size = frappe.form_dict.total_file_size if frappe.form_dict.chunk_index: current_chunk = int(frappe.form_dict.chunk_index) total_chunks = int(frappe.form_dict.total_chunk_count) @@ -177,6 +176,7 @@ def upload_file(): temp_path = Path(get_files_path(".temp-" + get_safe_file_name(filename), is_private=is_private)) with temp_path.open("ab" if current_chunk > 0 else "wb") as f: + total_file_size = frappe.form_dict.total_file_size or 0 f.seek(offset) f.write(file.stream.read()) if not f.tell() >= int(total_file_size) or current_chunk != total_chunks - 1: