{ NULL, 0 }
};
+char *version=VERSION;
/* mhparse.c */
extern char *tmp; /* directory to place temp files */
static int
store_generic(CT ct)
{
- char **ap, **vp, *cp;
+ char **ap, **vp, *cp, *filename;
CI ci = &ct->c_ctinfo;
/*
** (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 (filename && 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
}
}
+finished:
return store_content(ct, NULL);
}