From 002988ce8660fa1d9d89bd628b7d7e3314ff3e1f Mon Sep 17 00:00:00 2001 From: Stephan Date: Thu, 30 Jan 2014 08:45:43 +0100 Subject: [PATCH] U4-4144 - Media Cache dies due to new 'key' property in XML --- .../XmlPublishedCache/PublishedMediaCache.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs index c762874a88..1be0496979 100644 --- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs +++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs @@ -478,6 +478,10 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache // I'm not sure that _properties contains all properties including those without a value, // neither that GetProperty will return a property without a value vs. null... @zpqrtbnk + // List of properties that will appear in the XML and do not match + // anything in the ContentType, so they must be ignored. + static readonly string[] IgnoredKeys = { "version", "isDoc", "key" }; + public DictionaryPublishedContent( IDictionary valueDictionary, Func getParent, @@ -528,8 +532,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { IPublishedProperty property = null; - // must ignore that one - if (i.Key == "version" || i.Key == "isDoc") continue; + // must ignore those + if (IgnoredKeys.Contains(i.Key)) continue; if (i.Key.InvariantStartsWith("__")) { @@ -540,6 +544,8 @@ namespace Umbraco.Web.PublishedCache.XmlPublishedCache { // use property type to ensure proper conversion var propertyType = _contentType.GetPropertyType(i.Key); + if (propertyType == null) + throw new Exception("Internal error, property '" + i.Key + "' is not a valid property for that type of content."); property = new XmlPublishedProperty(propertyType, false, i.Value); // false :: never preview a media }