@@ -102,8 +102,6 @@ class Mimes
102102 ],
103103 'pptx ' => [
104104 'application/vnd.openxmlformats-officedocument.presentationml.presentation ' ,
105- 'application/x-zip ' ,
106- 'application/zip ' ,
107105 ],
108106 'wbxml ' => 'application/wbxml ' ,
109107 'wmlc ' => 'application/wmlc ' ,
@@ -512,20 +510,19 @@ public static function guessExtensionFromType(string $type, ?string $proposedExt
512510
513511 $ proposedExtension = trim (strtolower ($ proposedExtension ?? '' ));
514512
515- if ($ proposedExtension !== '' ) {
516- if (array_key_exists ($ proposedExtension , static ::$ mimes ) && in_array ($ type , is_string (static ::$ mimes [$ proposedExtension ]) ? [static ::$ mimes [$ proposedExtension ]] : static ::$ mimes [$ proposedExtension ], true )) {
517- // The detected mime type matches with the proposed extension.
518- return $ proposedExtension ;
519- }
520-
521- // An extension was proposed, but the media type does not match the mime type list.
522- return null ;
513+ if (
514+ $ proposedExtension !== ''
515+ && array_key_exists ($ proposedExtension , static ::$ mimes )
516+ && in_array ($ type , (array ) static ::$ mimes [$ proposedExtension ], true )
517+ ) {
518+ // The detected mime type matches with the proposed extension.
519+ return $ proposedExtension ;
523520 }
524521
525522 // Reverse check the mime type list if no extension was proposed.
526523 // This search is order sensitive!
527524 foreach (static ::$ mimes as $ ext => $ types ) {
528- if (( is_string ( $ types ) && $ types === $ type) || ( is_array ( $ types ) && in_array ( $ type , $ types , true ) )) {
525+ if (in_array ( $ type, ( array ) $ types , true )) {
529526 return $ ext ;
530527 }
531528 }
0 commit comments