From 545fa9e70a8308097554dc56ed0e82feb309bb34 Mon Sep 17 00:00:00 2001 From: RehanSaeed Date: Tue, 7 Jul 2015 20:30:21 +0100 Subject: [PATCH] Added MIME Types Added the following MIME types which I have found to be missing: .json - application/json (This one is pretty unbelievable) .ttc - application/x-font-ttf .webp - image/webp .appcache - text/cache-manifest .manifest - text/cache-manifest Also the following MIME types need updating: .ttf should be application/x-font-ttf and not application/octet-stream --- .../FileExtensionContentTypeProvider.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.AspNet.StaticFiles/FileExtensionContentTypeProvider.cs b/src/Microsoft.AspNet.StaticFiles/FileExtensionContentTypeProvider.cs index 0e52f8b55b..950bceafa1 100644 --- a/src/Microsoft.AspNet.StaticFiles/FileExtensionContentTypeProvider.cs +++ b/src/Microsoft.AspNet.StaticFiles/FileExtensionContentTypeProvider.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNet.StaticFiles /// public class FileExtensionContentTypeProvider : IContentTypeProvider { -#region Extension mapping table + #region Extension mapping table /// /// Creates a new provider with a set of default mappings. /// @@ -38,6 +38,7 @@ namespace Microsoft.AspNet.StaticFiles { ".aif", "audio/x-aiff" }, { ".aifc", "audio/aiff" }, { ".aiff", "audio/aiff" }, + { ".appcache", "text/cache-manifest" }, { ".application", "application/x-ms-application" }, { ".art", "image/x-jg" }, { ".asd", "application/octet-stream" }, @@ -143,6 +144,7 @@ namespace Microsoft.AspNet.StaticFiles { ".jpeg", "image/jpeg" }, { ".jpg", "image/jpeg" }, { ".js", "application/javascript" }, + { ".json", "application/json" }, { ".jsx", "text/jscript" }, { ".latex", "application/x-latex" }, { ".lit", "application/x-ms-reader" }, @@ -310,7 +312,8 @@ namespace Microsoft.AspNet.StaticFiles { ".trm", "application/x-msterminal" }, { ".ts", "video/vnd.dlna.mpeg-tts" }, { ".tsv", "text/tab-separated-values" }, - { ".ttf", "application/octet-stream" }, + { ".ttc", "application/x-font-ttf" }, + { ".ttf", "application/x-font-ttf" }, { ".tts", "video/vnd.dlna.mpeg-tts" }, { ".txt", "text/plain" }, { ".u32", "application/octet-stream" }, @@ -334,6 +337,7 @@ namespace Microsoft.AspNet.StaticFiles { ".wcm", "application/vnd.ms-works" }, { ".wdb", "application/vnd.ms-works" }, { ".webm", "video/webm" }, + { ".webp", "image/webp" }, { ".wks", "application/vnd.ms-works" }, { ".wm", "video/x-ms-wm" }, { ".wma", "audio/x-ms-wma" }, @@ -393,7 +397,7 @@ namespace Microsoft.AspNet.StaticFiles }) { } -#endregion + #endregion /// /// Creates a lookup engine using the provided mapping. @@ -431,4 +435,4 @@ namespace Microsoft.AspNet.StaticFiles return Mappings.TryGetValue(extension, out contentType); } } -} +} \ No newline at end of file