Selaa lähdekoodia

fix: dont allow blank content of unsupported type

version-14
Sagar Vora 2 vuotta sitten
vanhempi
commit
a9fd5f5001
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. +3
    -1
      frappe/handler.py

+ 3
- 1
frappe/handler.py Näytä tiedosto

@@ -206,7 +206,9 @@ def upload_file():
frappe.local.uploaded_file = content
frappe.local.uploaded_filename = filename

if content and (frappe.session.user == "Guest" or (user and not user.has_desk_access())):
if content is not None and (
frappe.session.user == "Guest" or (user and not user.has_desk_access())
):
filetype = guess_type(filename)[0]
if filetype not in ALLOWED_MIMETYPES:
frappe.throw(_("You can only upload JPG, PNG, PDF, TXT or Microsoft documents."))


Ladataan…
Peruuta
Tallenna