From eae3d830a7ca1a7d8bd2d7b24559cc9d0d055bae Mon Sep 17 00:00:00 2001 From: Stano Bocinec Date: Tue, 30 Mar 2021 11:06:04 +0200 Subject: [PATCH 1/4] Fix video/webm subclass element --- data/custom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/custom.xml b/data/custom.xml index 4766f15..77ec934 100644 --- a/data/custom.xml +++ b/data/custom.xml @@ -67,7 +67,7 @@ - + From 1153989678a86d809891eb6a99abec38451993f9 Mon Sep 17 00:00:00 2001 From: Stano Bocinec Date: Tue, 30 Mar 2021 11:36:20 +0200 Subject: [PATCH 2/4] Add additional custom font types (otf,woff,woff2) --- data/custom.xml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/data/custom.xml b/data/custom.xml index 77ec934..5d595e6 100644 --- a/data/custom.xml +++ b/data/custom.xml @@ -77,4 +77,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b8f8d314aa9a83c9a9deea02396a1535e5ada986 Mon Sep 17 00:00:00 2001 From: Stano Bocinec Date: Tue, 30 Mar 2021 12:16:34 +0200 Subject: [PATCH 3/4] Update data tables --- lib/marcel/tables.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/marcel/tables.rb b/lib/marcel/tables.rb index 2b3c2a2..ad77486 100644 --- a/lib/marcel/tables.rb +++ b/lib/marcel/tables.rb @@ -1139,6 +1139,8 @@ module Marcel 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wmz' => 'application/x-ms-wmz', + 'woff' => 'font/woff', + 'woff2' => 'font/woff2', 'wp' => 'application/vnd.wordperfect', 'wp5' => 'application/vnd.wordperfect', 'wp6' => 'application/vnd.wordperfect', @@ -1908,6 +1910,9 @@ module Marcel 'chemical/x-csml' => [%w(csml), %w(), nil], 'chemical/x-pdb' => [%w(pdb), %w(), 'Brookhaven Protein Databank File'], 'chemical/x-xyz' => [%w(xyz), %w(), nil], + 'font/otf' => [%w(otf), %w(font/ttf), nil], + 'font/woff' => [%w(woff), %w(), nil], + 'font/woff2' => [%w(woff2), %w(), nil], 'image/aces' => [%w(exr), %w(), 'ACES Image Container File'], 'image/avif' => [%w(avif), %w(), 'AV1 Image File'], 'image/bmp' => [%w(bmp dib), %w(), 'Windows bitmap'], @@ -2159,13 +2164,14 @@ module Marcel ['video/x-flv', [[0, 'FLV']]], ['audio/mpeg', [[0, "\377\362"], [0, "\377\363"], [0, "\377\364"], [0, "\377\365"], [0, "\377\366"], [0, "\377\367"], [0, "\377\372"], [0, "\377\373"], [0, "\377\374"], [0, "\377\375"], [0, "\377\377"], [0, 'ID3']]], ['application/pdf', [[0, '%PDF-'], [0, "\357\273\277%PDF-"]]], - ['application/msword', [[0..8, "\320\317\021\340\241\261\032\341", [[546, 'jbjb'], [546, 'bjbj']]]]], + ['application/msword', [[2080, 'Microsoft Word 6.0 Document'], [2080, 'Documento Microsoft Word 6'], [2112, 'MSWordDoc'], [0, "1\276\000\000"], [0, 'PO^Q`'], [0, "\3767\000#"], [0, "\333\245-\000\000\000"], [0, "\224\246."], [0..8, "\320\317\021\340\241\261\032\341", [[1152..4096, "W\000o\000r\000d\000D\000o\000c\000u\000m\000e\000n\000t"]]]]], ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', [[0, "PK\003\004", [[30, '[Content_Types].xml', [[0..4096, 'word/']]], [30, '_rels/.rels', [[0..4096, 'word/']]]]]]], ['application/vnd.ms-powerpoint', [[0..8, "\320\317\021\340\241\261\032\341", [[1152..4096, "P\000o\000w\000e\000r\000P\000o\000i\000n\000t\000 D\000o\000c\000u\000m\000e\000n\000t"]]]]], ['application/vnd.openxmlformats-officedocument.presentationml.presentation', [[0, "PK\003\004", [[30, '[Content_Types].xml', [[0..4096, 'ppt/']]], [30, '_rels/.rels', [[0..4096, 'ppt/']]]]]]], ['application/vnd.ms-excel', [[2080, 'Microsoft Excel 5.0 Worksheet'], [2080, 'Foglio di lavoro Microsoft Exce'], [2114, 'Biff5'], [2121, 'Biff5'], [0..8, "\320\317\021\340\241\261\032\341", [[1152..4096, "W\000o\000r\000k\000b\000o\000o\000k"]]]]], ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', [[0, "PK\003\004", [[30, '[Content_Types].xml', [[0..4096, 'xl/']]], [30, '_rels/.rels', [[0..4096, 'xl/']]]]]]], ['application/x-dbf', [[0, "(?s)^[\\\\002\\\\003\\\\060\\\\061\\\\062\\\\103\\\\143\\\\203\\\\213\\\\313\\\\365\\\\345\\\\373].[\\\\001-\\\\014][\\\\001-\\\\037].{4}(?:.[^\\\\000]|[\\\\101-\\\\377].)(?:[^\\\\000\\\\001].|.[^\\\\000]).{31}(?<=[\\\\000][^\\\\000]{0,10})[A-Z@+]"]]], + ['font/otf', [[0, 'OTTO'], [0, "\000\001\000\000"]]], ['image/x-tga', [[1, "\001\001\000\000", [[8, ".*[\\\\124\\\\122\\\\125\\\\105\\\\126\\\\111\\\\123\\\\111\\\\117\\\\116\\\\055\\\\130\\\\106\\\\111\\\\114\\\\105\\\\056\\\\000]"]]], [1, "\000\002\000\000", [[8, ".*[\\\\124\\\\122\\\\125\\\\105\\\\126\\\\111\\\\123\\\\111\\\\117\\\\116\\\\055\\\\130\\\\106\\\\111\\\\114\\\\105\\\\056\\\\000]"]]], [1, "\000\003\000\000", [[8, ".*[\\\\124\\\\122\\\\125\\\\105\\\\126\\\\111\\\\123\\\\111\\\\117\\\\116\\\\055\\\\130\\\\106\\\\111\\\\114\\\\105\\\\056\\\\000]"]]]]], ['application/x-endnote-refer', [[0..50, '%A ', [[0..1000, "\n%D ", [[0..1000, "\n%T "]]]]]]], ['application/x-ms-owner', [[0, "(?s)^([\\\\005-\\\\017])[\\\\000\\\\040-\\\\176]{10}.{43}\\\\1\\000"]]], @@ -2246,7 +2252,7 @@ module Marcel ['application/javascript', [[0, '/* jQuery '], [0, '/*! jQuery '], [0, '/*!', [[4..8, '* jQuery ']]], [0, '(function(e,undefined){'], [0, '!function(window,undefined){'], [0, '/* Prototype JavaScript '], [0, 'var Prototype={'], [0, 'function $w(t){'], [0, '/** @license React'], [0, '/**', [[4..8, '* React ']]]]], ['application/mac-binhex40', [[11, 'must be converted with BinHex']]], ['application/mathematica', [[0, '(**'], [0, '(* ']]], - ['application/msword', [[2080, 'Microsoft Word 6.0 Document'], [2080, 'Documento Microsoft Word 6'], [2112, 'MSWordDoc'], [0, "1\276\000\000"], [0, 'PO^Q`'], [0, "\3767\000#"], [0, "\333\245-\000\000\000"], [0, "\224\246."], [0..8, "\320\317\021\340\241\261\032\341", [[1152..4096, "W\000o\000r\000d\000D\000o\000c\000u\000m\000e\000n\000t"]]]]], + ['application/msword', [[0..8, "\320\317\021\340\241\261\032\341", [[546, 'jbjb'], [546, 'bjbj']]]]], ['application/msword2', [[0, "\233\245"], [0, "\333\245"]]], ['application/msword5', [[0, "\3767"]]], ['application/octet-stream', [[10, '# This is a shell archive'], [0, "\037\036"], [0, "\037\037"], [0, "\377\037"], [0, "\377\037"], [0, "\005\313"]]], @@ -2379,6 +2385,8 @@ module Marcel ['audio/x-ms-wma', [[0..8192, 'Windows Media Audio']]], ['audio/x-pn-realaudio', [[0, ".ra\375"]]], ['chemical/x-cdx', [[0, 'VjCD0100']]], + ['font/woff', [[0, 'wOFF']]], + ['font/woff2', [[0, 'wOF2']]], ['image/aces', [[0, "v/1\001\002\000\000\000"], [0, "v/1\001\002\004\000\000"]]], ['image/cgm', [[0, 'BEGMF']]], ['image/emf', [[0, "\001\000\000\000", [[40, ' EMF']]]]], From a60815d94f2c112db29d9d6a7c38d24b497ba44e Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Fri, 2 Apr 2021 07:27:49 -0400 Subject: [PATCH 4/4] Add OTF, WOFF, and WOFF2 test fixtures --- data/custom.xml | 19 ++++++------------- lib/marcel/mime_type/definitions.rb | 1 + lib/marcel/tables.rb | 4 +--- test/fixtures/magic/font/otf.otf | Bin 0 -> 1160 bytes test/fixtures/magic/font/woff.woff | Bin 0 -> 928 bytes test/fixtures/magic/font/woff2.woff2 | Bin 0 -> 472 bytes test/fixtures/name/font/otf.otf | Bin 0 -> 1160 bytes test/fixtures/name/font/woff.woff | Bin 0 -> 928 bytes test/fixtures/name/font/woff2.woff2 | Bin 0 -> 472 bytes 9 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 test/fixtures/magic/font/otf.otf create mode 100644 test/fixtures/magic/font/woff.woff create mode 100644 test/fixtures/magic/font/woff2.woff2 create mode 100644 test/fixtures/name/font/otf.otf create mode 100644 test/fixtures/name/font/woff.woff create mode 100644 test/fixtures/name/font/woff2.woff2 diff --git a/data/custom.xml b/data/custom.xml index 5d595e6..761e1cf 100644 --- a/data/custom.xml +++ b/data/custom.xml @@ -78,32 +78,25 @@ - - - - - - - - - - - - + + + - + + + diff --git a/lib/marcel/mime_type/definitions.rb b/lib/marcel/mime_type/definitions.rb index f7bd2fc..ac6dcc5 100644 --- a/lib/marcel/mime_type/definitions.rb +++ b/lib/marcel/mime_type/definitions.rb @@ -38,5 +38,6 @@ Marcel::MimeType.extend "video/mp4", magic: [[4, "ftypisom"], [4, "ftypM4V "]], extensions: %w( mp4 m4v ) Marcel::MimeType.extend "font/ttf", magic: [[0, "\x00\x01\x00\x00"]], extensions: %w( ttf ttc ) +Marcel::MimeType.extend "font/otf", magic: [[0, "OTTO"]], extensions: %w( otf ), parents: "font/ttf" Marcel::MimeType.extend "application/vnd.adobe.flash.movie", magic: [[0, "FWS"], [0, "CWS"]], extensions: %w( swf ) Marcel::MimeType.extend "application/sql", extensions: %w( sql ) diff --git a/lib/marcel/tables.rb b/lib/marcel/tables.rb index ad77486..b30c8e6 100644 --- a/lib/marcel/tables.rb +++ b/lib/marcel/tables.rb @@ -1910,7 +1910,6 @@ module Marcel 'chemical/x-csml' => [%w(csml), %w(), nil], 'chemical/x-pdb' => [%w(pdb), %w(), 'Brookhaven Protein Databank File'], 'chemical/x-xyz' => [%w(xyz), %w(), nil], - 'font/otf' => [%w(otf), %w(font/ttf), nil], 'font/woff' => [%w(woff), %w(), nil], 'font/woff2' => [%w(woff2), %w(), nil], 'image/aces' => [%w(exr), %w(), 'ACES Image Container File'], @@ -2171,7 +2170,6 @@ module Marcel ['application/vnd.ms-excel', [[2080, 'Microsoft Excel 5.0 Worksheet'], [2080, 'Foglio di lavoro Microsoft Exce'], [2114, 'Biff5'], [2121, 'Biff5'], [0..8, "\320\317\021\340\241\261\032\341", [[1152..4096, "W\000o\000r\000k\000b\000o\000o\000k"]]]]], ['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', [[0, "PK\003\004", [[30, '[Content_Types].xml', [[0..4096, 'xl/']]], [30, '_rels/.rels', [[0..4096, 'xl/']]]]]]], ['application/x-dbf', [[0, "(?s)^[\\\\002\\\\003\\\\060\\\\061\\\\062\\\\103\\\\143\\\\203\\\\213\\\\313\\\\365\\\\345\\\\373].[\\\\001-\\\\014][\\\\001-\\\\037].{4}(?:.[^\\\\000]|[\\\\101-\\\\377].)(?:[^\\\\000\\\\001].|.[^\\\\000]).{31}(?<=[\\\\000][^\\\\000]{0,10})[A-Z@+]"]]], - ['font/otf', [[0, 'OTTO'], [0, "\000\001\000\000"]]], ['image/x-tga', [[1, "\001\001\000\000", [[8, ".*[\\\\124\\\\122\\\\125\\\\105\\\\126\\\\111\\\\123\\\\111\\\\117\\\\116\\\\055\\\\130\\\\106\\\\111\\\\114\\\\105\\\\056\\\\000]"]]], [1, "\000\002\000\000", [[8, ".*[\\\\124\\\\122\\\\125\\\\105\\\\126\\\\111\\\\123\\\\111\\\\117\\\\116\\\\055\\\\130\\\\106\\\\111\\\\114\\\\105\\\\056\\\\000]"]]], [1, "\000\003\000\000", [[8, ".*[\\\\124\\\\122\\\\125\\\\105\\\\126\\\\111\\\\123\\\\111\\\\117\\\\116\\\\055\\\\130\\\\106\\\\111\\\\114\\\\105\\\\056\\\\000]"]]]]], ['application/x-endnote-refer', [[0..50, '%A ', [[0..1000, "\n%D ", [[0..1000, "\n%T "]]]]]]], ['application/x-ms-owner', [[0, "(?s)^([\\\\005-\\\\017])[\\\\000\\\\040-\\\\176]{10}.{43}\\\\1\\000"]]], @@ -2471,8 +2469,8 @@ module Marcel ['message/rfc822', [[0..1000, "\nMessage-ID:"]]], ['text/html', [[0..64, 'zm&sSeKgd(n`r5`t0_NM~6swmvS}??-COAbK z<$C4a*XB{`;{VuccGg&@VttROyMlywYPT1bhGu_a(4ql&`}Bt4%Ue&ffY(h0{lwr~ z>5&XwuM4CkOlHZ{PmE+85^tuU?ju5F+jv9$ULe&soKo@rCI7{9aN){cUYBP&wmsRhC8)(qJRtDKcx zXmi*n<2VQXx}Hakv-c&8go^I}EsWVilInnyoZvs&*Dx;(Pf#hN1|?S}w|flljnC%p zn041y+BUUqO%5P_y)>isUtk~77n~G&#fXEYAqN;AB~{auv)_bD$>_z!Rb Bc5eUx literal 0 HcmV?d00001 diff --git a/test/fixtures/magic/font/woff.woff b/test/fixtures/magic/font/woff.woff new file mode 100644 index 0000000000000000000000000000000000000000..55d893b4324ce3afe15f43759577baa31495a644 GIT binary patch literal 928 zcmXT-cXMN4WB>x@1q^&3n&k(G#0K2lLVSVhT7YsgAY639#n#=$)eR_?0_4kqu_gnT zf3Ut00|Vm*Am1E_6ZqB}dMD>5768RSX4?a4CkB4D)5&Ee3JeTP7C zhM;pyH=%L~i4PJIk{B2{I2o%Hm>8H=GB_}R^<7Iym~-I3sRIX0CcoriW_Gr3Nvk=V zaOT8G2M!AZ4Iq^N!QXO*y}>4A!GQxD3?}^Ch71}&e*@hMqQMwsM?ykcLxLom8=Jre z#!nIlYsA=C70xoXDC|4*|G&Ve|H&)7*xbz6Bqldb_ zIPtr0?#W2-Etn{-A;B~81JB8fKgS}%?@ti%b`4<-XH^frEGZ;vck|k}$!}$B`*I&Y z{a^HFn)QPy+bdkXYRtuL^NeHVXKufiEMD3*`A+*``4vEiRNT@%?a1d~Ai#QI{VL9l z0^A$laI%PRC}20=FoDDK?$OG>*WUYlinlUm$l7y4ApY2|?6rvB5uwPDVj%Ug3^hUs0{Txb1HpQEF8`Mu!zE6t4_96WfCwV#vOO>LX4&GFiw znG$=a*?+X;GlRrQk^@^0&x;0Dol{2+@Gvl(gyba#Mqv772InuJAUMS^0eQ?|F;JRk a0%8yV=fJB=)Hy($bIYp0;^%4?8vy{AsSO(d literal 0 HcmV?d00001 diff --git a/test/fixtures/magic/font/woff2.woff2 b/test/fixtures/magic/font/woff2.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..076b416dd2d4469d1c16446abcbfa1a427a0aa51 GIT binary patch literal 472 zcmXT-cQayOWB>xj8w`9Pn&k(O-3So_@lk=jn_GyljFcQ(0z;D%2a6yFS0h8C05=x{ zqZyM5vjB?%YhyIKmNXm72|3QPH%G#b9Gm>{!`Az+ckY&EsQdY9dtkisyVZEEVui3KC5Jc z#fn8I@0U&fIlFnydKM$2Wvn-}xqY;?L|hl#ioI{VyPj2GEsKJX5QD;rf*9pk_czlV z8Q-3GaZqDHf-h5`mv^|gf8_hDmpQwy)ooq;aohj5&uTtL6hDmSH7z;3d&7?Jwb2`Q zepBK7w)EF3+E@L#!;t+W&zm&sSeKgd(n`r5`t0_NM~6swmvS}??-COAbK z<$C4a*XB{`;{VuccGg&@VttROyMlywYPT1bhGu_a(4ql&`}Bt4%Ue&ffY(h0{lwr~ z>5&XwuM4CkOlHZ{PmE+85^tuU?ju5F+jv9$ULe&soKo@rCI7{9aN){cUYBP&wmsRhC8)(qJRtDKcx zXmi*n<2VQXx}Hakv-c&8go^I}EsWVilInnyoZvs&*Dx;(Pf#hN1|?S}w|flljnC%p zn041y+BUUqO%5P_y)>isUtk~77n~G&#fXEYAqN;AB~{auv)_bD$>_z!Rb Bc5eUx literal 0 HcmV?d00001 diff --git a/test/fixtures/name/font/woff.woff b/test/fixtures/name/font/woff.woff new file mode 100644 index 0000000000000000000000000000000000000000..55d893b4324ce3afe15f43759577baa31495a644 GIT binary patch literal 928 zcmXT-cXMN4WB>x@1q^&3n&k(G#0K2lLVSVhT7YsgAY639#n#=$)eR_?0_4kqu_gnT zf3Ut00|Vm*Am1E_6ZqB}dMD>5768RSX4?a4CkB4D)5&Ee3JeTP7C zhM;pyH=%L~i4PJIk{B2{I2o%Hm>8H=GB_}R^<7Iym~-I3sRIX0CcoriW_Gr3Nvk=V zaOT8G2M!AZ4Iq^N!QXO*y}>4A!GQxD3?}^Ch71}&e*@hMqQMwsM?ykcLxLom8=Jre z#!nIlYsA=C70xoXDC|4*|G&Ve|H&)7*xbz6Bqldb_ zIPtr0?#W2-Etn{-A;B~81JB8fKgS}%?@ti%b`4<-XH^frEGZ;vck|k}$!}$B`*I&Y z{a^HFn)QPy+bdkXYRtuL^NeHVXKufiEMD3*`A+*``4vEiRNT@%?a1d~Ai#QI{VL9l z0^A$laI%PRC}20=FoDDK?$OG>*WUYlinlUm$l7y4ApY2|?6rvB5uwPDVj%Ug3^hUs0{Txb1HpQEF8`Mu!zE6t4_96WfCwV#vOO>LX4&GFiw znG$=a*?+X;GlRrQk^@^0&x;0Dol{2+@Gvl(gyba#Mqv772InuJAUMS^0eQ?|F;JRk a0%8yV=fJB=)Hy($bIYp0;^%4?8vy{AsSO(d literal 0 HcmV?d00001 diff --git a/test/fixtures/name/font/woff2.woff2 b/test/fixtures/name/font/woff2.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..076b416dd2d4469d1c16446abcbfa1a427a0aa51 GIT binary patch literal 472 zcmXT-cQayOWB>xj8w`9Pn&k(O-3So_@lk=jn_GyljFcQ(0z;D%2a6yFS0h8C05=x{ zqZyM5vjB?%YhyIKmNXm72|3QPH%G#b9Gm>{!`Az+ckY&EsQdY9dtkisyVZEEVui3KC5Jc z#fn8I@0U&fIlFnydKM$2Wvn-}xqY;?L|hl#ioI{VyPj2GEsKJX5QD;rf*9pk_czlV z8Q-3GaZqDHf-h5`mv^|gf8_hDmpQwy)ooq;aohj5&uTtL6hDmSH7z;3d&7?Jwb2`Q zepBK7w)EF3+E@L#!;t+W&