fix: make file size param optional

This commit is contained in:
Safwan Samsudeen 2026-03-12 13:51:24 +05:30
parent f26bd9ee67
commit a5100b18d9

View file

@ -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: