diff options
author | Eduardo Chappa <chappa@washington.edu> | 2016-07-31 20:38:01 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2016-07-31 20:38:01 -0600 |
commit | 37652c6ff8acf7acb2196371a2c049647fc4b6c5 (patch) | |
tree | 735d237431f9ad176e24633ca127e3fc20ba63e3 /pith/mimetype.c | |
parent | 72f1f0e3de5c91874572cf530bf5f2d35ba2ba5f (diff) | |
download | alpine-37652c6ff8acf7acb2196371a2c049647fc4b6c5.tar.xz |
* When Alpine opens an attachment, it sometimes changes the extension
of the file that is being opened and replaces it by another for the
same mime type. If Alpine finds that the extension of the file
corresponds with the mime type, according to the mime-types file,
then it will keep it, and no substitution will be made.
Diffstat (limited to 'pith/mimetype.c')
-rw-r--r-- | pith/mimetype.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pith/mimetype.c b/pith/mimetype.c index a5292269..5b5bed77 100644 --- a/pith/mimetype.c +++ b/pith/mimetype.c @@ -18,6 +18,7 @@ static char rcsid[] = "$Id: mimetype.c 955 2008-03-06 23:52:36Z hubert@u.washing #include "../pith/headers.h" #include "../pith/mimetype.h" +#include "../pith/mimedesc.h" #include "../pith/state.h" #include "../pith/conf.h" #include "../pith/mailcap.h" @@ -92,6 +93,23 @@ set_mime_extension_by_type (char *ext, char *mtype) } +int +check_mime_type_by_extension (char *ext, char *mtype) +{ + MT_MAP_T e2t; + char mimet[128]; + + if((e2t.from.ext = ext) != NULL && *e2t.from.ext + && mt_srch_mime_type(mt_srch_by_ext, &e2t)){ + snprintf(mimet, sizeof(mimet), "%s/%s", + body_type_names(e2t.to.mime.type), e2t.to.mime.subtype); + mimet[sizeof(mimet) - 1] = '\0'; + fs_give((void **)& e2t.to.mime.subtype); + return strucmp(mimet, mtype) ? 0 : 1; + } + + return(0); +} /* |