mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-05 19:54:53 +00:00
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:
@@ -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)));
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user