#20399: white-listing supported image types, which allows for previously unsupported types like svg to be handled by the document factory instead of causing the image factory to throw.

This commit is contained in:
Bertrand Le Roy
2014-03-23 12:48:39 -07:00
parent e96c392479
commit af2f57401d

View File

@@ -1,4 +1,5 @@
using System;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using Orchard.ContentManagement;
@@ -22,6 +23,9 @@ namespace Orchard.MediaLibrary.Factories {
if (!mimeType.StartsWith("image/")) {
return null;
}
if (!ImageCodecInfo.GetImageDecoders().Select(d => d.MimeType).Contains(mimeType)) {
return null;
}
if (!String.IsNullOrEmpty(contentType)) {
var contentDefinition = _contentDefinitionManager.GetTypeDefinition(contentType);