libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 1aef5b17e80660f94fbc78c6a6d7bbb690c620c4
parent b4c3dc327f3f13eccf3ad7626844196eaa792045
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  2 Sep 2005 10:04:04 +0000

ole2 improvements

Diffstat:
Msrc/plugins/ole2/ole2extractor.c | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -922,6 +922,7 @@ libextractor_ole2_extract(const char * filename, struct GsfInfileMSOle * infile; struct GsfInput * src; const char * name; + const char * software = 0; int i; input = gsf_input_new((const unsigned char*) date, @@ -956,6 +957,24 @@ libextractor_ole2_extract(const char * filename, gsf_input_finalize(src); } gsf_infile_msole_finalize(infile); + + /* + * Hack to return an appropriate mimetype + */ + software = EXTRACTOR_extractLast(EXTRACTOR_SOFTWARE, prev); + if(NULL != software) { + const char * mimetype = "application/vnd.ms-files"; + + if(0 == strncmp(software, "Microsoft Word", 14)) + mimetype = "application/msword"; + else if(0 == strncmp(software, "Microsoft Excel", 15)) + mimetype = "application/vnd.ms-excel"; + else if(0 == strncmp(software, "Microsoft PowerPoint", 19)) + mimetype = "application/vnd.ms-powerpoint"; + + prev = addKeyword(prev, mimetype, EXTRACTOR_MIMETYPE); + } + return prev; }