Merge pull request #38307 from frappe/fix-webform-upload
fix: add default if boot data isn't present
This commit is contained in:
commit
05489dbd2b
2 changed files with 2 additions and 3 deletions
|
|
@ -165,7 +165,7 @@ def upload_file():
|
|||
file = files["file"]
|
||||
filename = file.filename
|
||||
|
||||
if frappe.form_dict.chunk_index:
|
||||
if frappe.form_dict.get("chunk_index") is not None:
|
||||
current_chunk = int(frappe.form_dict.chunk_index)
|
||||
total_chunks = int(frappe.form_dict.total_chunk_count)
|
||||
offset = int(frappe.form_dict.chunk_byte_offset)
|
||||
|
|
|
|||
|
|
@ -571,7 +571,7 @@ function return_as_dataurl() {
|
|||
async function upload_file(file, i) {
|
||||
currently_uploading.value = i;
|
||||
|
||||
const CHUNK_SIZE = frappe.boot.file_chunk_size;
|
||||
const CHUNK_SIZE = frappe.boot.file_chunk_size || 25 * 1024 * 1024;
|
||||
|
||||
const use_chunks = file.file_obj && file.file_obj.size > CHUNK_SIZE;
|
||||
const total_chunks = use_chunks ? Math.ceil(file.file_obj.size / CHUNK_SIZE) : 1;
|
||||
|
|
@ -685,7 +685,6 @@ async function upload_file(file, i) {
|
|||
xhr.setRequestHeader("X-Frappe-CSRF-Token", frappe.csrf_token);
|
||||
|
||||
let form_data = new FormData();
|
||||
|
||||
if (chunk_blob) {
|
||||
form_data.append("file", chunk_blob, file.name);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue