mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-13 21:56:20 +00:00
a few more async optimizations
This commit is contained in:
parent
1c5f728ec2
commit
fbf8cc833c
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Common.Net.Handlers
|
||||
@@ -16,37 +15,7 @@ namespace MediaBrowser.Common.Net.Handlers
|
||||
|
||||
public override Task<string> GetContentType()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
string extension = Path.GetExtension(ResourcePath);
|
||||
|
||||
if (extension.EndsWith("jpeg", StringComparison.OrdinalIgnoreCase) || extension.EndsWith("jpg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/jpeg";
|
||||
}
|
||||
else if (extension.EndsWith("png", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/png";
|
||||
}
|
||||
else if (extension.EndsWith("ico", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "image/ico";
|
||||
}
|
||||
else if (extension.EndsWith("js", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "application/x-javascript";
|
||||
}
|
||||
else if (extension.EndsWith("css", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "text/css";
|
||||
}
|
||||
else if (extension.EndsWith("html", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return "text/html; charset=utf-8";
|
||||
}
|
||||
|
||||
return "text/plain; charset=utf-8";
|
||||
});
|
||||
return Task.FromResult<string>(MimeTypes.GetMimeType(ResourcePath));
|
||||
}
|
||||
|
||||
protected override Task WriteResponseToOutputStream(Stream stream)
|
||||
|
||||
Reference in New Issue
Block a user