Dnn.Platform
Dnn.Platform copied to clipboard
Fixed DDRMenu to handle duplicate page names
Fixes #4483
Summary
The bug is located here (irrelevant parts omitted for brevity):

The FilterNodes function cycles through the names specified in the "IncludeNodes" attribute (available in the nodeTextStrings variable). For each of these names, it invokes the FindByNameOrId function of the root node of the menu. The idea is to populate the filteredNodes list with all the nodes that we need to preserve. Later on, the RemoveAll(<predicate>) function is called, which takes care of removing all items of the menu that are not present in this list.
The problem is that FindByNameOrId just returns the first node that meets the criteria. When several pages share a common name, only the page that is found first survives this purge.
The solution I analyzed first was changing FindByNameOrId to return a list of all matching nodes, and not just the first node that satisfies the condition. However, this function is a public function referenced from several places. Changing its signature would be a breaking change.
So I chose to create a new function for this purpose (FindAllByNameOrId) and modify FilterNodes to call this new function instead.
Cool, thanks for the fix :-)
It would be a bit of a breaking change for some sites. I assigned this to Dnn10 for that reason.