File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1203,4 +1203,22 @@ describe("applyMediaUnderstanding", () => {
12031203 expect ( ctx . Body ) . toContain ( "<file" ) ;
12041204 expect ( ctx . Body ) . toContain ( "vendor-json" ) ;
12051205 } ) ;
1206+
1207+ it ( "skips legacy Office binary formats carried as msword or x-cfb" , async ( ) => {
1208+ const oleMagic = Buffer . from ( "d0cf11e0a1b11ae1" , "hex" ) ;
1209+ for ( const mime of [ "application/msword" , "application/x-cfb" ] ) {
1210+ const filePath = await createTempMediaFile ( {
1211+ fileName : mime === "application/msword" ? "legacy.doc" : "legacy.cfb" ,
1212+ content : oleMagic ,
1213+ } ) ;
1214+
1215+ const { ctx, result } = await applyWithDisabledMedia ( {
1216+ body : "<media:file>" ,
1217+ mediaPath : filePath ,
1218+ mediaType : mime ,
1219+ } ) ;
1220+
1221+ expectFileNotApplied ( { ctx, result, body : "<media:file>" } ) ;
1222+ }
1223+ } ) ;
12061224} ) ;
Original file line number Diff line number Diff line change @@ -299,7 +299,9 @@ function isBinaryMediaMime(mime?: string): boolean {
299299 mime === "application/gzip" ||
300300 mime === "application/x-gzip" ||
301301 mime === "application/x-rar-compressed" ||
302- mime === "application/x-7z-compressed"
302+ mime === "application/x-7z-compressed" ||
303+ mime === "application/x-cfb" ||
304+ mime === "application/msword"
303305 ) {
304306 return true ;
305307 }
You can’t perform that action at this time.
0 commit comments