@@ -102,8 +102,6 @@ class Mimes
102
102
],
103
103
'pptx ' => [
104
104
'application/vnd.openxmlformats-officedocument.presentationml.presentation ' ,
105
- 'application/x-zip ' ,
106
- 'application/zip ' ,
107
105
],
108
106
'wbxml ' => 'application/wbxml ' ,
109
107
'wmlc ' => 'application/wmlc ' ,
@@ -512,20 +510,19 @@ public static function guessExtensionFromType(string $type, ?string $proposedExt
512
510
513
511
$ proposedExtension = trim (strtolower ($ proposedExtension ?? '' ));
514
512
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 ;
523
520
}
524
521
525
522
// Reverse check the mime type list if no extension was proposed.
526
523
// This search is order sensitive!
527
524
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 )) {
529
526
return $ ext ;
530
527
}
531
528
}
0 commit comments