Refactor MimeTypes.ToExtension()

Co-authored-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
Ahmed Rafiq 2021-12-04 21:13:18 +06:00 committed by GitHub
parent 40e05a7993
commit 0e491025ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -181,13 +181,8 @@ namespace MediaBrowser.Model.Net
return result;
}
var extensions = Model.MimeTypes.GetMimeTypeExtensions(mimeType);
if (extensions.Any())
{
return "." + extensions.First();
}
return null;
var extension = Model.MimeTypes.GetMimeTypeExtensions(mimeType).FirstOrDefault();
return string.IsNullOrEmpty(extension) ? null : "." + extension;
}
}
}