diff options
Diffstat (limited to 'MediaBrowser.Model/Net/MimeTypes.cs')
| -rw-r--r-- | MediaBrowser.Model/Net/MimeTypes.cs | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.cs index d66d62fea..fe13413e2 100644 --- a/MediaBrowser.Model/Net/MimeTypes.cs +++ b/MediaBrowser.Model/Net/MimeTypes.cs @@ -1,8 +1,8 @@ -using MediaBrowser.Model.Extensions; using System; using System.Collections.Generic; using System.IO; using System.Linq; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Net { @@ -48,7 +48,7 @@ namespace MediaBrowser.Model.Net private static Dictionary<string, string> GetVideoFileExtensionsDictionary() { - Dictionary<string, string> dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach (string ext in VideoFileExtensions) { @@ -65,7 +65,7 @@ namespace MediaBrowser.Model.Net private static Dictionary<string, string> GetMimeTypeLookup() { - Dictionary<string, string> dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); + var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); dict.Add(".jpg", "image/jpeg"); dict.Add(".jpeg", "image/jpeg"); @@ -127,13 +127,12 @@ namespace MediaBrowser.Model.Net { if (string.IsNullOrEmpty(path)) { - throw new ArgumentNullException("path"); + throw new ArgumentNullException(nameof(path)); } var ext = Path.GetExtension(path) ?? string.Empty; - string result; - if (MimeTypeLookup.TryGetValue(ext, out result)) + if (MimeTypeLookup.TryGetValue(ext, out string result)) { return result; } @@ -183,6 +182,10 @@ namespace MediaBrowser.Model.Net { return "text/plain"; } + if (StringHelper.EqualsIgnoreCase(ext, ".log")) + { + return "text/plain"; + } if (StringHelper.EqualsIgnoreCase(ext, ".xml")) { return "application/xml"; @@ -228,10 +231,10 @@ namespace MediaBrowser.Model.Net if (StringHelper.EqualsIgnoreCase(ext, ".oga")) { return "audio/ogg"; - } - if (StringHelper.EqualsIgnoreCase(ext, ".opus")) - { - return "audio/ogg"; + } + if (StringHelper.EqualsIgnoreCase(ext, ".opus")) + { + return "audio/ogg"; } if (StringHelper.EqualsIgnoreCase(ext, ".ac3")) { @@ -329,14 +332,13 @@ namespace MediaBrowser.Model.Net { if (string.IsNullOrEmpty(mimeType)) { - throw new ArgumentNullException("mimeType"); + throw new ArgumentNullException(nameof(mimeType)); } // handle text/html; charset=UTF-8 mimeType = mimeType.Split(';')[0]; - string result; - if (ExtensionLookup.TryGetValue(mimeType, out result)) + if (ExtensionLookup.TryGetValue(mimeType, out string result)) { return result; } |
