MimeType - Add extra checking to Cef.GetMimeType

Also update the ResourceHandler.FromFilePath xml doc to reference Cef.GetMimeType

Issue #3041
This commit is contained in:
amaitland
2020-03-24 18:22:03 +10:00
parent 344a9297dd
commit 006445df03
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -763,10 +763,16 @@ namespace CefSharp
/// <returns>Returns the mime type for the specified file extension or an empty string if unknown.</returns>
static String^ GetMimeType(String^ extension)
{
if (extension == nullptr)
{
throw gcnew ArgumentNullException("extension");
}
if (extension->StartsWith("."))
{
extension = extension->Substring(1, extension->Length - 1);
}
return StringUtils::ToClr(CefGetMimeType(StringUtils::ToNative(extension)));
}
+1 -1
View File
@@ -258,7 +258,7 @@ namespace CefSharp
}
/// <summary>
/// Gets the resource from the file path specified. Use the <see cref="GetMimeType"/>
/// Gets the resource from the file path specified. Use the Cef.GetMimeType()
/// helper method to lookup the mimeType if required. Uses CefStreamResourceHandler for reading the data
/// </summary>
/// <param name="filePath">Location of the file.</param>