@@ -29,72 +29,72 @@ final class AssetMapperDevServerSubscriber implements EventSubscriberInterface
29
29
// source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
30
30
private const EXTENSIONS_MAP = [
31
31
'aac ' => 'audio/aac ' ,
32
- 'abw ' => 'application/x-abiword ' ,
33
- 'arc ' => 'application/x-freearc ' ,
34
- 'avif ' => 'image/avif ' ,
35
- 'avi ' => 'video/x-msvideo ' ,
36
- 'azw ' => 'application/vnd.amazon.ebook ' ,
37
- 'bin ' => 'application/octet-stream ' ,
38
- 'bmp ' => 'image/bmp ' ,
39
- 'bz ' => 'application/x-bzip ' ,
40
- 'bz2 ' => 'application/x-bzip2 ' ,
41
- 'cda ' => 'application/x-cdf ' ,
42
- 'csh ' => 'application/x-csh ' ,
43
- 'css ' => 'text/css ' ,
44
- 'csv ' => 'text/csv ' ,
45
- 'doc ' => 'application/msword ' ,
46
- 'docx ' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document ' ,
47
- 'eot ' => 'application/vnd.ms-fontobject ' ,
48
- 'epub ' => 'application/epub+zip ' ,
49
- 'gz ' => 'application/gzip ' ,
50
- 'gif ' => 'image/gif ' ,
51
- 'htm ' => 'text/html ' ,
52
- 'html ' => 'text/html ' ,
53
- 'ico ' => 'image/vnd.microsoft.icon ' ,
54
- 'ics ' => 'text/calendar ' ,
55
- 'jar ' => 'application/java-archive ' ,
56
- 'jpeg ' => 'image/jpeg ' ,
57
- 'jpg ' => 'image/jpeg ' ,
58
- 'js ' => 'text/javascript ' ,
59
- 'json ' => 'application/json ' ,
60
- 'jsonld ' => 'application/ld+json ' ,
61
- 'mid ' => 'audio/midi ' ,
62
- 'midi ' => 'audio/midi ' ,
63
- 'mjs ' => 'text/javascript ' ,
64
- 'mp3 ' => 'audio/mpeg ' ,
65
- 'mp4 ' => 'video/mp4 ' ,
66
- 'mpeg ' => 'video/mpeg ' ,
67
- 'mpkg ' => 'application/vnd.apple.installer+xml ' ,
68
- 'odp ' => 'application/vnd.oasis.opendocument.presentation ' ,
69
- 'ods ' => 'application/vnd.oasis.opendocument.spreadsheet ' ,
70
- 'odt ' => 'application/vnd.oasis.opendocument.text ' ,
71
- 'oga ' => 'audio/ogg ' ,
72
- 'ogv ' => 'video/ogg ' ,
73
- 'ogx ' => 'application/ogg ' ,
74
- 'opus ' => 'audio/opus ' ,
75
- 'otf ' => 'font/otf ' ,
76
- 'png ' => 'image/png ' ,
77
- 'pdf ' => 'application/pdf ' ,
78
- 'php ' => 'application/x-httpd-php ' ,
79
- 'ppt ' => 'application/vnd.ms-powerpoint ' ,
80
- 'pptx ' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation ' ,
81
- 'rar ' => 'application/vnd.rar ' ,
82
- 'rtf ' => 'application/rtf ' ,
83
- 'sh ' => 'application/x-sh ' ,
84
- 'svg ' => 'image/svg+xml ' ,
85
- 'tar ' => 'application/x-tar ' ,
86
- 'tif ' => 'image/tiff ' ,
87
- 'tiff ' => 'image/tiff ' ,
88
- 'ts ' => 'video/mp2t ' ,
89
- 'ttf ' => 'font/ttf ' ,
90
- 'txt ' => 'text/plain ' ,
91
- 'vsd ' => 'application/vnd.visio ' ,
92
- 'wav ' => 'audio/wav ' ,
93
- 'weba ' => 'audio/webm ' ,
94
- 'webm ' => 'video/webm ' ,
95
- 'webp ' => 'image/webp ' ,
96
- 'woff ' => 'font/woff ' ,
97
- 'woff2 ' => 'font/woff2 ' ,
32
+ 'abw ' => 'application/x-abiword ' ,
33
+ 'arc ' => 'application/x-freearc ' ,
34
+ 'avif ' => 'image/avif ' ,
35
+ 'avi ' => 'video/x-msvideo ' ,
36
+ 'azw ' => 'application/vnd.amazon.ebook ' ,
37
+ 'bin ' => 'application/octet-stream ' ,
38
+ 'bmp ' => 'image/bmp ' ,
39
+ 'bz ' => 'application/x-bzip ' ,
40
+ 'bz2 ' => 'application/x-bzip2 ' ,
41
+ 'cda ' => 'application/x-cdf ' ,
42
+ 'csh ' => 'application/x-csh ' ,
43
+ 'css ' => 'text/css ' ,
44
+ 'csv ' => 'text/csv ' ,
45
+ 'doc ' => 'application/msword ' ,
46
+ 'docx ' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document ' ,
47
+ 'eot ' => 'application/vnd.ms-fontobject ' ,
48
+ 'epu
6D4E
b ' => 'application/epub+zip ' ,
49
+ 'gz ' => 'application/gzip ' ,
50
+ 'gif ' => 'image/gif ' ,
51
+ 'htm ' => 'text/html ' ,
52
+ 'html ' => 'text/html ' ,
53
+ 'ico ' => 'image/vnd.microsoft.icon ' ,
54
+ 'ics ' => 'text/calendar ' ,
55
+ 'jar ' => 'application/java-archive ' ,
56
+ 'jpeg ' => 'image/jpeg ' ,
57
+ 'jpg ' => 'image/jpeg ' ,
58
+ 'js ' => 'text/javascript ' ,
59
+ 'json ' => 'application/json ' ,
60
+ 'jsonld ' => 'application/ld+json ' ,
61
+ 'mid ' => 'audio/midi ' ,
62
+ 'midi ' => 'audio/midi ' ,
63
+ 'mjs ' => 'text/javascript ' ,
64
+ 'mp3 ' => 'audio/mpeg ' ,
65
+ 'mp4 ' => 'video/mp4 ' ,
66
+ 'mpeg ' => 'video/mpeg ' ,
67
+ 'mpkg ' => 'application/vnd.apple.installer+xml ' ,
68
+ 'odp ' => 'application/vnd.oasis.opendocument.presentation ' ,
69
+ 'ods ' => 'application/vnd.oasis.opendocument.spreadsheet ' ,
70
+ 'odt ' => 'application/vnd.oasis.opendocument.text ' ,
71
+ 'oga ' => 'audio/ogg ' ,
72
+ 'ogv ' => 'video/ogg ' ,
73
+ 'ogx ' => 'application/ogg ' ,
74
+ 'opus ' => 'audio/opus ' ,
75
+ 'otf ' => 'font/otf ' ,
76
+ 'png ' => 'image/png ' ,
77
+ 'pdf ' => 'application/pdf ' ,
78
+ 'php ' => 'application/x-httpd-php ' ,
79
+ 'ppt ' => 'application/vnd.ms-powerpoint ' ,
80
+ 'pptx ' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation ' ,
81
+ 'rar ' => 'application/vnd.rar ' ,
82
+ 'rtf ' => 'application/rtf ' ,
83
+ 'sh ' => 'application/x-sh ' ,
84
+ 'svg ' => 'image/svg+xml ' ,
85
+ 'tar ' => 'application/x-tar ' ,
86
+ 'tif ' => 'image/tiff ' ,
87
+ 'tiff ' => 'image/tiff ' ,
88
+ 'ts ' => 'video/mp2t ' ,
89
+ 'ttf ' => 'font/ttf ' ,
90
+ 'txt ' => 'text/plain ' ,
91
+ 'vsd ' => 'application/vnd.visio ' ,
92
+ 'wav ' => 'audio/wav ' ,
93
+ 'weba ' => 'audio/webm ' ,
94
+ 'webm ' => 'video/webm ' ,
95
+ 'webp ' => 'image/webp ' ,
96
+ 'woff ' => 'font/woff ' ,
97
+ 'woff2 ' => 'font/woff2 ' ,
98
98
];
99
99
100
100
private readonly string $ publicPrefix ;
@@ -132,10 +132,10 @@ public function onKernelRequest(RequestEvent $event): void
132
132
throw new NotFoundHttpException (sprintf ('Asset with public path "%s" not found. ' , $ pathInfo ));
133
133
}
134
134
135
- $ mimeType = $ this ->getMimeType ($ asset ->getPublicPath ());
135
+ $ mediaType = $ this ->getMediaType ($ asset ->getPublicPath ());
136
136
$ response = (new Response (
137
137
$ asset ->getContent (),
138
- headers: $ mimeType ? ['Content-Type ' => $ mimeType ] : [],
138
+ headers: $ mediaType ? ['Content-Type ' => $ mediaType ] : [],
139
139
))
140
140
->setPublic ()
141
141
->setMaxAge (604800 )
@@ -154,7 +154,7 @@ public static function getSubscribedEvents(): array
154
154
];
155
155
}
156
156
157
- private function getMimeType (string $ path ): ?string
157
+ private function getMediaType (string $ path ): ?string
158
158
{
159
159
$ extension = pathinfo ($ path , \PATHINFO_EXTENSION );
160
160
0 commit comments