Hi. On Sun, Sep 28, 2008 at 11:58:42PM +0300, Ori Avtalion wrote: > After changing the matching technique, I added a test for a new file > format: "OCF container (EPUB)", which is used for ebooks and defined in: > <http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm> > > -Ori
Interesting. I'm facing similar concerns trying to support mime type detection for another kind of Zip container. Note that the Open Document Packages in specs 1.2 (still draft at the time of writing, see part 3 of the specs) seem to generalize this. May I suggest an alternative patch that sets application/zip for all such files containing "mimetypeapplication/...PK\2\3" ? It includes a matching for OCF, and illustrates how to add other application/x-... mimetypes. Hope this helps. Best regards,
--- Magdir/archive.orig 2011-03-09 19:07:49.000000000 +0100 +++ Magdir/archive 2011-03-09 19:16:18.000000000 +0100 @@ -588,80 +588,100 @@ # From: Abel Cheung <[email protected]> >30 string mimetype +>>38 string application/ + # KOffice (1.2 or above) formats ->>50 string vnd.kde. KOffice (>=1.2) ->>>58 string karbon Karbon document ->>>58 string kchart KChart document ->>>58 string kformula KFormula document ->>>58 string kivio Kivio document ->>>58 string kontour Kontour document ->>>58 string kpresenter KPresenter document ->>>58 string kspread KSpread document ->>>58 string kword KWord document +>>>50 string vnd.kde. KOffice (>=1.2) +>>>>58 string karbon Karbon document +>>>>58 string kchart KChart document +>>>>58 string kformula KFormula document +>>>>58 string kivio Kivio document +>>>>58 string kontour Kontour document +>>>>58 string kpresenter KPresenter document +>>>>58 string kspread KSpread document +>>>>58 string kword KWord document # OpenOffice formats (for OpenOffice 1.x / StarOffice 6/7) ->>50 string vnd.sun.xml. OpenOffice.org 1.x ->>>62 string writer Writer ->>>>68 byte !0x2e document ->>>>68 string .template template ->>>>68 string .global global document ->>>62 string calc Calc ->>>>66 byte !0x2e spreadsheet ->>>>66 string .template template ->>>62 string draw Draw ->>>>66 byte !0x2e document ->>>>66 string .template template ->>>62 string impress Impress ->>>>69 byte !0x2e presentation ->>>>69 string .template template ->>>62 string math Math document ->>>62 string base Database file +>>>50 string vnd.sun.xml. OpenOffice.org 1.x +>>>>62 string writer Writer +>>>>>68 byte !0x2e document +>>>>>68 string .template template +>>>>>68 string .global global document +>>>>62 string calc Calc +>>>>>66 byte !0x2e spreadsheet +>>>>>66 string .template template +>>>>62 string draw Draw +>>>>>66 byte !0x2e document +>>>>>66 string .template template +>>>>62 string impress Impress +>>>>>69 byte !0x2e presentation +>>>>>69 string .template template +>>>>62 string math Math document +>>>>62 string base Database file # OpenDocument formats (for OpenOffice 2.x / StarOffice >= 8) # http://lists.oasis-open.org/archives/office/200505/msg00006.html ->>50 string vnd.oasis.opendocument. OpenDocument ->>>73 string text ->>>>77 byte !0x2d Text +>>>50 string vnd.oasis.opendocument. OpenDocument +>>>>73 string text +>>>>>77 byte !0x2d Text !:mime application/vnd.oasis.opendocument.text ->>>>77 string -template Text Template +>>>>>77 string -template Text Template !:mime application/vnd.oasis.opendocument.text-template ->>>>77 string -web HTML Document Template +>>>>>77 string -web HTML Document Template !:mime application/vnd.oasis.opendocument.text-web ->>>>77 string -master Master Document +>>>>>77 string -master Master Document !:mime application/vnd.oasis.opendocument.text-master ->>>73 string graphics ->>>>81 byte !0x2d Drawing +>>>>73 string graphics +>>>>>81 byte !0x2d Drawing !:mime application/vnd.oasis.opendocument.graphics ->>>>81 string -template Template +>>>>>81 string -template Template !:mime application/vnd.oasis.opendocument.graphics-template ->>>73 string presentation ->>>>85 byte !0x2d Presentation +>>>>73 string presentation +>>>>>85 byte !0x2d Presentation !:mime application/vnd.oasis.opendocument.presentation ->>>>85 string -template Template +>>>>>85 string -template Template !:mime application/vnd.oasis.opendocument.presentation-template ->>>73 string spreadsheet ->>>>84 byte !0x2d Spreadsheet +>>>>73 string spreadsheet +>>>>>84 byte !0x2d Spreadsheet !:mime application/vnd.oasis.opendocument.spreadsheet ->>>>84 string -template Template +>>>>>84 string -template Template !:mime application/vnd.oasis.opendocument.spreadsheet-template ->>>73 string chart ->>>>78 byte !0x2d Chart +>>>>73 string chart +>>>>>78 byte !0x2d Chart !:mime application/vnd.oasis.opendocument.chart ->>>>78 string -template Template +>>>>>78 string -template Template !:mime application/vnd.oasis.opendocument.chart-template ->>>73 string formula ->>>>80 byte !0x2d Formula +>>>>73 string formula +>>>>>80 byte !0x2d Formula !:mime application/vnd.oasis.opendocument.formula ->>>>80 string -template Template +>>>>>80 string -template Template !:mime application/vnd.oasis.opendocument.formula-template ->>>73 string database Database +>>>>73 string database Database !:mime application/vnd.oasis.opendocument.database ->>>73 string image ->>>>78 byte !0x2d Image +>>>>73 string image +>>>>>78 byte !0x2d Image !:mime application/vnd.oasis.opendocument.image ->>>>78 string -template Template +>>>>>78 string -template Template !:mime application/vnd.oasis.opendocument.image-template +# Other Zip based containers (OCF container or Open Document 1.2 Packages) + +>>>50 string epub+zip OCF container (EPUB) +!:mime application/epub+zip + +# For Zip based containing application/x-... mimetype +>>>50 string x- Zip container + +# Any known ones shoud be set here explicitely like : +# >>>>50 string x-planetforge-forge-export (PlanetForge export) +# !:mime application/x-planetforge-forge-export +# so that there mime type is set (dunno how to do something like %s for !:mime :-( ) + +# default : the mime-type will be application/zip +>>>>50 regex \^[0-9a-z_:\-]+ (application/%s +>>>>>&0 string PK\3\4 \b) +!:mime application/zip + # Zoo archiver 20 lelong 0xfdc4a7dc Zoo archive data !:mime application/x-zoo

