U4-2257 - MediaService.Save doesn't serialize nodeTypeAlias by default, BackOffice does

Created by Randy McCluer 22 May 2013, 15:02:16 Updated by Morten Christensen 02 Jun 2013, 13:30:13

Ran into this because DAMP uses nodeTypeAlias for filtering.


Morten Christensen 30 May 2013, 19:30:32

You mean the XML cache for media or? Not sure I'm following.

Randy McCluer 30 May 2013, 21:06:46

public static XElement ToXml(this IMedia media) { //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck();

        var x = media.ToXml(nodeName);
        x.Add(new XAttribute("nodeType", media.ContentType.Id));
        x.Add(new XAttribute("writerName", media.GetCreatorProfile().Name));
        x.Add(new XAttribute("writerID", media.CreatorId));
        x.Add(new XAttribute("version", media.Version));
        x.Add(new XAttribute("template", 0));
        if (UmbracoSettings.UseLegacyXmlSchema)
            x.Add(new XAttribute("nodeTypeAlias", media.ContentType.Alias));

        return x;

Morten Christensen 02 Jun 2013, 13:30:10

Corrected for both Content and Media. As far as I can tell its been like this for the lifetime of v6, so surprised no one has noticed it before :-S

Priority: Normal

Type: Bug

State: Fixed

Assignee: Morten Christensen

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 6.1.0

Due in version: 6.1.1


Story Points: