mirror of https://github.com/adamdruppe/arsd.git
fixes for attachment processing, as instructed by A.Ruppe
This commit is contained in:
parent
9c22d7465b
commit
64531cf1db
24
email.d
24
email.d
|
@ -351,6 +351,9 @@ class MimePart {
|
||||||
string gpgproto;
|
string gpgproto;
|
||||||
|
|
||||||
MimeAttachment toMimeAttachment() {
|
MimeAttachment toMimeAttachment() {
|
||||||
|
if(type == "multipart/mixed" && stuff.length == 1)
|
||||||
|
return stuff[0].toMimeAttachment;
|
||||||
|
|
||||||
MimeAttachment att;
|
MimeAttachment att;
|
||||||
att.type = type;
|
att.type = type;
|
||||||
att.filename = filename;
|
att.filename = filename;
|
||||||
|
@ -407,6 +410,8 @@ class MimePart {
|
||||||
auto name = h[0 .. idx].strip.toLower;
|
auto name = h[0 .. idx].strip.toLower;
|
||||||
auto content = h[idx + 1 .. $].strip;
|
auto content = h[idx + 1 .. $].strip;
|
||||||
|
|
||||||
|
string[4] filenames_found;
|
||||||
|
|
||||||
switch(name) {
|
switch(name) {
|
||||||
case "content-type":
|
case "content-type":
|
||||||
parseContentType(content);
|
parseContentType(content);
|
||||||
|
@ -423,6 +428,19 @@ class MimePart {
|
||||||
case "filename":
|
case "filename":
|
||||||
filename = v;
|
filename = v;
|
||||||
break;
|
break;
|
||||||
|
// FIXME: https://datatracker.ietf.org/doc/html/rfc2184#section-3 is what it is SUPPOSED to do
|
||||||
|
case "filename*0":
|
||||||
|
filenames_found[0] = v;
|
||||||
|
break;
|
||||||
|
case "filename*1":
|
||||||
|
filenames_found[1] = v;
|
||||||
|
break;
|
||||||
|
case "filename*2":
|
||||||
|
filenames_found[2] = v;
|
||||||
|
break;
|
||||||
|
case "filename*3":
|
||||||
|
filenames_found[3] = v;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,6 +450,12 @@ class MimePart {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filenames_found[0] != "") {
|
||||||
|
foreach (string v; filenames_found) {
|
||||||
|
this.filename ~= v;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue