U4-4144 - work around media cache exceptions on invalid properties

This commit is contained in:
Stephan
2014-01-29 19:30:17 +01:00
parent ccaf82d797
commit 8b553dd067

View File

@@ -539,6 +539,26 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache
{
// use property type to ensure proper conversion
var propertyType = _contentType.GetPropertyType(i.Key);
// note: this is where U4-4144 and -3665 were born
//
// because propertyType is null, the XmlPublishedProperty ctor will throw
// it's null because i.Key is not a valid property alias for the type...
// the alias is case insensitive (verified) so it means it really is not
// a correct alias.
//
// in every cases this is after a ConvertFromXPathNavigator, so it means
// that we get some properties from the XML that are not valid properties.
// no idea which property. could come from the cache in library, could come
// from so many places really.
// workaround: just ignore that property
if (propertyType == null)
{
LogHelper.Warn<PublishedMediaCache>("Dropping property \"" + i.Key + "\" because it does not belong to the content type.");
continue;
}
property = new XmlPublishedProperty(propertyType, false, i.Value); // false :: never preview a media
}