fix wrong filename in email attachment, frappe/erpnext#1947

This commit is contained in:
Pratik Vyas 2014-07-16 23:43:37 +05:30
parent fbbf5beef0
commit eb6a2cf42f
2 changed files with 6 additions and 4 deletions

View file

@ -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)

View file

@ -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]