Skip to content

Commit 05489db

Browse files
authored
Merge pull request frappe#38307 from frappe/fix-webform-upload
fix: add default if boot data isn't present
2 parents e2abc0e + 474cdcf commit 05489db

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

frappe/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def upload_file():
165165
file = files["file"]
166166
filename = file.filename
167167

168-
if frappe.form_dict.chunk_index:
168+
if frappe.form_dict.get("chunk_index") is not None:
169169
current_chunk = int(frappe.form_dict.chunk_index)
170170
total_chunks = int(frappe.form_dict.total_chunk_count)
171171
offset = int(frappe.form_dict.chunk_byte_offset)

frappe/public/js/frappe/file_uploader/FileUploader.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ function return_as_dataurl() {
571571
async function upload_file(file, i) {
572572
currently_uploading.value = i;
573573
574-
const CHUNK_SIZE = frappe.boot.file_chunk_size;
574+
const CHUNK_SIZE = frappe.boot.file_chunk_size || 25 * 1024 * 1024;
575575
576576
const use_chunks = file.file_obj && file.file_obj.size > CHUNK_SIZE;
577577
const total_chunks = use_chunks ? Math.ceil(file.file_obj.size / CHUNK_SIZE) : 1;
@@ -685,7 +685,6 @@ async function upload_file(file, i) {
685685
xhr.setRequestHeader("X-Frappe-CSRF-Token", frappe.csrf_token);
686686
687687
let form_data = new FormData();
688-
689688
if (chunk_blob) {
690689
form_data.append("file", chunk_blob, file.name);
691690
}

0 commit comments

Comments
 (0)