bytes to string
This commit is contained in:
parent
f8a9678e73
commit
67132f775c
1 changed files with 2 additions and 2 deletions
|
|
@ -110,7 +110,7 @@ def save_url(file_url, filename, dt, dn, folder, is_private, df=None):
|
|||
def get_uploaded_content():
|
||||
# should not be unicode when reading a file, hence using frappe.form
|
||||
if 'filedata' in frappe.form_dict:
|
||||
if b"," in frappe.form_dict.filedata:
|
||||
if "," in frappe.form_dict.filedata:
|
||||
frappe.form_dict.filedata = frappe.form_dict.filedata.rsplit(",", 1)[1]
|
||||
frappe.uploaded_content = base64.b64decode(frappe.form_dict.filedata)
|
||||
frappe.uploaded_filename = frappe.form_dict.filename
|
||||
|
|
@ -124,7 +124,7 @@ def save_file(fname, content, dt, dn, folder=None, decode=False, is_private=0, d
|
|||
if isinstance(content, text_type):
|
||||
content = content.encode("utf-8")
|
||||
|
||||
if b"," in content:
|
||||
if "," in content:
|
||||
content = content.split(",")[1]
|
||||
content = base64.b64decode(content)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue