Skip to content

Commit 002988c

Browse files
committed
U4-4144 - Media Cache dies due to new 'key' property in XML
1 parent 81c3271 commit 002988c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedMediaCache.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,10 @@ internal class DictionaryPublishedContent : PublishedContentBase
478478
// I'm not sure that _properties contains all properties including those without a value,
479479
// neither that GetProperty will return a property without a value vs. null... @zpqrtbnk
480480

481+
// List of properties that will appear in the XML and do not match
482+
// anything in the ContentType, so they must be ignored.
483+
static readonly string[] IgnoredKeys = { "version", "isDoc", "key" };
484+
481485
public DictionaryPublishedContent(
482486
IDictionary<string, string> valueDictionary,
483487
Func<DictionaryPublishedContent, IPublishedContent> getParent,
@@ -528,8 +532,8 @@ public DictionaryPublishedContent(
528532
{
529533
IPublishedProperty property = null;
530534

531-
// must ignore that one
532-
if (i.Key == "version" || i.Key == "isDoc") continue;
535+
// must ignore those
536+
if (IgnoredKeys.Contains(i.Key)) continue;
533537

534538
if (i.Key.InvariantStartsWith("__"))
535539
{
@@ -540,6 +544,8 @@ public DictionaryPublishedContent(
540544
{
541545
// use property type to ensure proper conversion
542546
var propertyType = _contentType.GetPropertyType(i.Key);
547+
if (propertyType == null)
548+
throw new Exception("Internal error, property '" + i.Key + "' is not a valid property for that type of content.");
543549
property = new XmlPublishedProperty(propertyType, false, i.Value); // false :: never preview a media
544550
}
545551

0 commit comments

Comments
 (0)