forked from gordon-matt/elFinder.NetCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMimeHelper.cs
More file actions
19 lines (16 loc) · 792 Bytes
/
Copy pathMimeHelper.cs
File metadata and controls
19 lines (16 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
namespace elFinder.NetCore.Helpers;
using elFinder.NetCore.Models;
public static class MimeHelper
{
public static MimeType GetMimeType(string extension)
{
// TODO:
// 1. Ensure all values from MimeTypes.txt are in MimeTypeMap and then delete MimeTypes.txt.
// 2. Compare MimeTypeMap with: https://codingislove.com/list-mime-types-2016/
// 3. Compare MimeTypeMap with: https://slick.pl/kb/htaccess/complete-list-mime-types/
// 4. Consider modifying MimeTypeMap to return our custom MimeType struct, so that we don't need this MimeHelper class anymore
string mimeType = MimeTypeMap.GetMimeType(extension);
string[] split = mimeType.Split('/');
return new MimeType { Type = split[0], Subtype = split[1] };
}
}