Pārlūkot izejas kodu

fix: check mimetype if content is present (#17456)

version-14
Raffael Meyer pirms 2 gadiem
committed by GitHub
vecāks
revīzija
bbfdc52e5c
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 3 papildinājumiem un 1 dzēšanām
  1. +3
    -1
      frappe/handler.py

+ 3
- 1
frappe/handler.py Parādīt failu

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

if not file_url and (frappe.session.user == "Guest" or (user and not user.has_desk_access())):
if (not file_url or content) 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."))


Notiek ielāde…
Atcelt
Saglabāt