@@ -458,12 +458,12 @@ describe("media store", () => {
458458 } ,
459459 } ,
460460 {
461- name : "prefers detected stream mime over generic zip header extension" ,
461+ name : "prefers detected stream mime over mixed-case generic zip header extension" ,
462462 run : async ( ) => {
463463 await withTempStore ( async ( storeLocal10 ) => {
464464 const saved = await storeLocal10 . saveMediaStream (
465465 Readable . from ( [ Buffer . from ( "docx" ) ] ) ,
466- "application/zip " ,
466+ "Application/Zip " ,
467467 "stream-inbound" ,
468468 1024 ,
469469 undefined ,
@@ -687,22 +687,7 @@ describe("media store", () => {
687687 expectedExtension : ".custom" ,
688688 } ,
689689 {
690- name : "does not preserve image header extensions for generic container buffers" ,
691- bufferFactory : async ( ) => {
692- const zip = new JSZip ( ) ;
693- zip . file ( "hello.txt" , "hi" ) ;
694- return await zip . generateAsync ( { type : "nodebuffer" } ) ;
695- } ,
696- contentType : "image/png" ,
697- originalFilename : "fake.png" ,
698- expectedContentType : "application/zip" ,
699- expectedExtension : ".zip" ,
700- assertSaved : async ( saved : Awaited < ReturnType < typeof store . saveMediaBuffer > > ) => {
701- expect ( path . basename ( saved . path ) ) . toMatch ( / ^ f a k e - - - [ a - f 0 - 9 - ] { 36 } \. z i p $ / ) ;
702- } ,
703- } ,
704- {
705- name : "does not preserve image header extensions for mixed-case header mime" ,
690+ name : "does not preserve mixed-case image header extensions for generic container buffers" ,
706691 bufferFactory : async ( ) => {
707692 const zip = new JSZip ( ) ;
708693 zip . file ( "hello.txt" , "hi" ) ;
@@ -716,22 +701,6 @@ describe("media store", () => {
716701 expect ( path . basename ( saved . path ) ) . toMatch ( / ^ f a k e - - - [ a - f 0 - 9 - ] { 36 } \. z i p $ / ) ;
717702 } ,
718703 } ,
719- {
720- name : "detects docx from mixed-case application/zip header via buffer sniffing" ,
721- bufferFactory : async ( ) => {
722- const zip = new JSZip ( ) ;
723- zip . file ( "hello.txt" , "hi" ) ;
724- return await zip . generateAsync ( { type : "nodebuffer" } ) ;
725- } ,
726- contentType : "Application/Zip" ,
727- originalFilename : "report.docx" ,
728- expectedContentType :
729- "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ,
730- expectedExtension : ".docx" ,
731- assertSaved : async ( saved : Awaited < ReturnType < typeof store . saveMediaBuffer > > ) => {
732- expect ( path . basename ( saved . path ) ) . toMatch ( / ^ r e p o r t - - - [ a - f 0 - 9 - ] { 36 } \. d o c x $ / ) ;
733- } ,
734- } ,
735704 ] as const ) ( "$name" , async ( testCase ) => {
736705 const buffer =
737706 "bufferFactory" in testCase && testCase . bufferFactory
0 commit comments