libextractor

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

commit 57992374becabe484515a7f26ed22b3ac421a67c
parent ab7bc7ecf4722b14e83b4ce0fefed026a38815dd
Author: Christian Grothoff <christian@grothoff.org>
Date:   Tue, 27 Sep 2005 17:51:01 +0000

Better mimetype detection for MS-Word files


From: 
Ronan MELENNEC <ronan.melennec@cena.fr>


To: 
christian@grothoff.org


Date: 
Today 03:15:41


Hello Christian,

An anonymous contributor to your site presents an MS-Word file
which doesn't yield the expected mimetype.

Attached patch (relative to the current SVN) should correct this.

Cordially,
--
Ronan Melennec          | DGAC/DSNA/DTI/SDER/3/RFM
<melennec@ath.cena.fr>  | Division Routes, Flux et Modélisations (RFM)
+33 (0) 1 69 57 69 28   | Orly Sud 205 -- 94542 ORLY AEROGARE CEDEX
--


Diffstat:
MChangeLog | 3+++
Msrc/plugins/ole2/ole2extractor.c | 13+++++++++----
2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +Tue Sep 27 11:01:57 PDT 2005 + Again better Mime-type detection for OLE2 streams. + Mon Sep 26 20:44:10 PDT 2005 Minor improvements to the PDF extractor: - first change is to avoid outputting keywords with empty values diff --git a/src/plugins/ole2/ole2extractor.c b/src/plugins/ole2/ole2extractor.c @@ -2206,13 +2206,18 @@ libextractor_ole2_extract(const char * filename, if(NULL != software) { const char * mimetype = "application/vnd.ms-files"; - if(0 == strncmp(software, "Microsoft Word", 14)) + if((0 == strncmp(software, "Microsoft Word", 14)) || + (0 == strncmp(software, "Microsoft Office Word", 21))) mimetype = "application/msword"; - else if(0 == strncmp(software, "Microsoft Excel", 15)) + else if((0 == strncmp(software, "Microsoft Excel", 15)) || + (0 == strncmp(software, "Microsoft Office Excel", 22))) mimetype = "application/vnd.ms-excel"; - else if(0 == strncmp(software, "Microsoft PowerPoint", 19)) + else if((0 == strncmp(software, "Microsoft PowerPoint", 20)) || + (0 == strncmp(software, "Microsoft Office PowerPoint", 27))) mimetype = "application/vnd.ms-powerpoint"; - + else if(0 == strncmp(software, "Microsoft Office", 16)) + mimetype = "application/vnd.ms-office"; + prev = addKeyword(prev, mimetype, EXTRACTOR_MIMETYPE); }