Merge pull request #23333 from maharshivpatel/fix-file-max-upload-size

fix: honour max file size in upload file
This commit is contained in:
Ankush Menat 2023-11-22 10:56:42 +05:30 committed by GitHub
commit 9738936f60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -179,9 +179,12 @@ def init_request(request):
raise frappe.SessionStopped("Session Stopped")
else:
frappe.connect(set_admin_as_user=False)
if request.path.startswith("/api/method/upload_file"):
from frappe.core.api.file import get_max_file_size
request.max_content_length = cint(frappe.local.conf.get("max_file_size")) or 10 * 1024 * 1024
request.max_content_length = get_max_file_size()
else:
request.max_content_length = cint(frappe.local.conf.get("max_file_size")) or 25 * 1024 * 1024
make_form_dict(request)
if request.method != "OPTIONS":

View file

@ -122,12 +122,12 @@ def get_letter_heads():
def load_conf_settings(bootinfo):
from frappe import conf
from frappe.core.api.file import get_max_file_size
bootinfo.max_file_size = conf.get("max_file_size") or 10485760
bootinfo.max_file_size = get_max_file_size()
for key in ("developer_mode", "socketio_port", "file_watcher_port"):
if key in conf:
bootinfo[key] = conf.get(key)
if key in frappe.conf:
bootinfo[key] = frappe.conf.get(key)
def load_desktop_data(bootinfo):