Using the following script, on cc.Count()>0 with a non existent folder (as in a made up media ID) the output of cc.Count() = 1, and the script renders an empty <li> (as the macro is running as though it's true).
Is this an issue with 4.11.x? Or a global issue when using the media library?
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
if ( String.IsNullOrEmpty(@Parameter.mediaFolder) ) {
<div><p>A folder has not been selected</p></div>
}
var folder = Parameter.mediaFolder;
var media = Model.MediaById(folder);
}
@helper traverse(dynamic node) {
var cc = node.Children;
if (cc.Count()>0) {
<ul>
@foreach (var c in cc) {
<li>
@structure(c)
@traverse(c)
</li>
}
</ul>
}
}
@helper structure( dynamic node ){
if ( node.NodeTypeAlias == "Folder" ) {
<span class="folder" id="@node.Name.ToLower().Replace(" ", "_")">@node.Name</span>
} else {
<a href="@node.Url" target="_blank">@node.Name</a>
}
}
<div class="formWrangler">
@traverse(media)
</div>
Script renders "1" on non existent media folder
Edit: v4.11.8
Using the following script, on cc.Count()>0 with a non existent folder (as in a made up media ID) the output of cc.Count() = 1, and the script renders an empty
<li>
(as the macro is running as though it's true).Is this an issue with 4.11.x? Or a global issue when using the media library?
is working on a reply...