X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhstore.c;h=2b909effb4b796e71829642628411d9f4ed7eb2d;hp=adaca774d191b82f486880013cfbc88c2e37533a;hb=6306992cd580d47c217edb1ae98d58b24d5be8c9;hpb=be582c44948fe09cba55e538f1c9e2f57edb11ad diff --git a/uip/mhstore.c b/uip/mhstore.c index adaca77..2b909ef 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -468,7 +468,7 @@ store_switch(CT ct) static int store_generic(CT ct) { - char **ap, **vp, *cp; + char **ap, **vp, *cp, *filename; CI ci = &ct->c_ctinfo; /* @@ -477,6 +477,18 @@ store_generic(CT ct) ** (only the "message" subtype "rfc822" will use store_generic). */ if (autosw && ct->c_type != CT_MESSAGE) { + /* First check for "filename" in Content-Disposition header */ + filename = extract_name_value("filename", ct->c_dispo); + if (strcmp(filename, ct->c_dispo)!=0) { + /* We found "filename" */ + cp = mhbasename(filename); + if (*cp && *cp!='.' && *cp!='|' && *cp!='!' && + !strchr(cp, '%')) { + /* filename looks good: use it */ + ct->c_storeproc = mh_xstrdup(cp); + goto finished; + } + } /* ** Check the attribute/value pairs, for the attribute "name". ** If found, take the basename, do a few sanity checks and @@ -496,6 +508,7 @@ store_generic(CT ct) } } +finished: return store_content(ct, NULL); }