fix wrong filename in email attachment, frappe/erpnext#1947
This commit is contained in:
parent
fbbf5beef0
commit
eb6a2cf42f
2 changed files with 6 additions and 4 deletions
|
|
@ -142,7 +142,7 @@ class EMail:
|
|||
# Set the filename parameter
|
||||
if fname:
|
||||
part.add_header(b'Content-Disposition',
|
||||
("attachment; filename=%s" % fname).encode('utf-8'))
|
||||
("attachment; filename=\"%s\"" % fname).encode('utf-8'))
|
||||
|
||||
self.msg_root.attach(part)
|
||||
|
||||
|
|
|
|||
|
|
@ -208,11 +208,13 @@ def get_file(fname):
|
|||
else:
|
||||
file_name = fname
|
||||
|
||||
if not "/" in file_name:
|
||||
file_name = "files/" + file_name
|
||||
file_path = file_name
|
||||
|
||||
if not "/" in file_path:
|
||||
file_path = "files/" + file_path
|
||||
|
||||
# read the file
|
||||
with open(get_site_path("public", file_name), 'r') as f:
|
||||
with open(get_site_path("public", file_path), 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
return [file_name, content]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue