From 47744e75f2f5cd237eff62cb579142a5cfa6ee5f Mon Sep 17 00:00:00 2001 From: Emil Nicolaie Perhinschi Date: Thu, 12 Aug 2021 23:25:24 +0300 Subject: [PATCH] fix name for attachment when content type is application/octet-stream --- email.d | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/email.d b/email.d index 39be8fe..13b7ba8 100644 --- a/email.d +++ b/email.d @@ -351,12 +351,20 @@ class MimePart { string gpgproto; MimeAttachment toMimeAttachment() { + import std.array: empty; + import std.stdio:writeln; + if(type == "multipart/mixed" && stuff.length == 1) return stuff[0].toMimeAttachment; MimeAttachment att; att.type = type; - att.filename = filename; + if ( att.type == "application/octet-stream" && filename.empty && !name.empty ) { + writeln("============>>>>", type, "<<<, name: ", name.length, ", filename: ", filename.length); + att.filename = name; + } else { + att.filename = filename; + } att.id = id; att.content = content; return att;