Skip to content

Commit

Permalink
Revert "Fixes maartenba#322, using custom URL resolver throws "multip…
Browse files Browse the repository at this point in the history
…le nodes with same URL" exception."

This reverts commit bc43bf9.
  • Loading branch information
NightOwl888 committed Jun 10, 2014
1 parent bc43bf9 commit e0e3dea
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 35 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,7 @@ IUrlPath urlPath

// Host name in absolute URL overrides this one.
this.hostName = node.HostName;

// Fixes #322 - If using a custom URL resolver, we need to account for the case that
// the URL will be provided by the resolver instead of specified explicitly.
if (!string.IsNullOrEmpty(node.UnresolvedUrl))
{
this.SetUrlValues(node.UnresolvedUrl);
}
else if (!node.UsesDefaultUrlResolver())
{
// For a custom URL resolver, if the unresolved URL property
// is not set use the one returned from the URL resolver.
// This ensures URLs that are unidentifiable by MVC can still
// be matched by URL.
this.SetUrlValues(node.Url);
}
this.SetUrlValues(node.UnresolvedUrl);
}

private readonly ISiteMapNode node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@
<Compile Include="Globalization\CultureContextFactory.cs" />
<Compile Include="Globalization\ICultureContextFactory.cs" />
<Compile Include="Globalization\ICultureContext.cs" />
<Compile Include="ISiteMapNodeExtensions.cs" />
<Compile Include="ISiteMapNodeProvider.cs" />
<Compile Include="ISiteMapSettings.cs" />
<Compile Include="ISortable.cs" />
Expand Down
8 changes: 7 additions & 1 deletion src/MvcSiteMapProvider/MvcSiteMapProvider/SiteMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected virtual void AddNodeInternal(ISiteMapNode node, ISiteMapNode parentNod
lock (this.synclock)
{
IUrlKey url = null;
bool isMvcUrl = string.IsNullOrEmpty(node.UnresolvedUrl) && node.UsesDefaultUrlResolver();
bool isMvcUrl = string.IsNullOrEmpty(node.UnresolvedUrl) && this.UsesDefaultUrlResolver(node);

// Only store URLs if they are clickable and are configured using the Url
// property or provided by a custom URL resolver.
Expand Down Expand Up @@ -816,6 +816,12 @@ protected virtual ISiteMapNode ReturnNodeIfAccessible(ISiteMapNode node)
return null;
}

protected virtual bool UsesDefaultUrlResolver(ISiteMapNode node)
{
return string.IsNullOrEmpty(node.UrlResolver) ||
typeof(MvcSiteMapProvider.Web.UrlResolver.SiteMapNodeUrlResolver).Equals(Type.GetType(node.UrlResolver, false));
}

protected virtual void AssertSiteMapNodeConfigurationIsValid(ISiteMapNode node)
{
ThrowIfTitleNotSet(node);
Expand Down

0 comments on commit e0e3dea

Please sign in to comment.