123123
This commit is contained in:
@@ -5,14 +5,14 @@ namespace ZelWiki.Library
|
||||
internal static class MimeTypes
|
||||
{
|
||||
/// <summary>
|
||||
/// Given a file path, determine the MIME type
|
||||
/// 给定文件路径,确定MIME类型
|
||||
/// </summary>
|
||||
/// <param name="subpath">A file path</param>
|
||||
/// <param name="filePath">A file path</param>
|
||||
/// <param name="contentType">The resulting MIME type</param>
|
||||
/// <returns>True if MIME type could be determined</returns>
|
||||
public static bool TryGetContentType(string filePath, [MaybeNullWhen(false)] out string contentType)
|
||||
{
|
||||
string extension = Path.GetExtension(filePath);
|
||||
var extension = Path.GetExtension(filePath);
|
||||
if (extension == null)
|
||||
{
|
||||
contentType = null;
|
||||
@@ -20,8 +20,7 @@ namespace ZelWiki.Library
|
||||
}
|
||||
return Collection.TryGetValue(extension, out contentType);
|
||||
}
|
||||
|
||||
//Borrowed from FileExtensionContentTypeProvider().TryGetContentType
|
||||
|
||||
public static Dictionary<string, string> Collection = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ ".323", "text/h323" },
|
||||
@@ -78,7 +77,7 @@ namespace ZelWiki.Library
|
||||
{ ".crt", "application/x-x509-ca-cert" },
|
||||
{ ".csh", "application/x-csh" },
|
||||
{ ".css", "text/css" },
|
||||
{ ".csv", "text/csv" }, // https://tools.ietf.org/html/rfc7111#section-5.1
|
||||
{ ".csv", "text/csv" },
|
||||
{ ".cur", "application/octet-stream" },
|
||||
{ ".dcr", "application/x-director" },
|
||||
{ ".deploy", "application/octet-stream" },
|
||||
@@ -106,7 +105,7 @@ namespace ZelWiki.Library
|
||||
{ ".eps", "application/postscript" },
|
||||
{ ".etx", "text/x-setext" },
|
||||
{ ".evy", "application/envoy" },
|
||||
{ ".exe", "application/vnd.microsoft.portable-executable" }, // https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable
|
||||
{ ".exe", "application/vnd.microsoft.portable-executable" },
|
||||
{ ".fdf", "application/vnd.fdf" },
|
||||
{ ".fif", "application/fractals" },
|
||||
{ ".fla", "application/octet-stream" },
|
||||
@@ -347,7 +346,7 @@ namespace ZelWiki.Library
|
||||
{ ".wcm", "application/vnd.ms-works" },
|
||||
{ ".wdb", "application/vnd.ms-works" },
|
||||
{ ".webm", "video/webm" },
|
||||
{ ".webmanifest", "application/manifest+json" }, // https://w3c.github.io/manifest/#media-type-registration
|
||||
{ ".webmanifest", "application/manifest+json" },
|
||||
{ ".webp", "image/webp" },
|
||||
{ ".wks", "application/vnd.ms-works" },
|
||||
{ ".wm", "video/x-ms-wm" },
|
||||
@@ -362,8 +361,8 @@ namespace ZelWiki.Library
|
||||
{ ".wmv", "video/x-ms-wmv" },
|
||||
{ ".wmx", "video/x-ms-wmx" },
|
||||
{ ".wmz", "application/x-ms-wmz" },
|
||||
{ ".woff", "application/font-woff" }, // https://www.w3.org/TR/WOFF/#appendix-b
|
||||
{ ".woff2", "font/woff2" }, // https://www.w3.org/TR/WOFF2/#IMT
|
||||
{ ".woff", "application/font-woff" },
|
||||
{ ".woff2", "font/woff2" },
|
||||
{ ".wps", "application/vnd.ms-works" },
|
||||
{ ".wri", "application/x-mswrite" },
|
||||
{ ".wrl", "x-world/x-vrml" },
|
||||
|
||||
Reference in New Issue
Block a user