Skip to content

Commit

Permalink
Fixing 4549: Page Browser not working properly
Browse files Browse the repository at this point in the history
  • Loading branch information
napernik committed Nov 6, 2013
1 parent 8313dd9 commit 62b1615
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
22 changes: 11 additions & 11 deletions Composite/Core/Routing/PageUrls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,40 @@ public static IPageUrlProvider UrlProvider
/// <summary>
/// Parses the URL.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="absoluteUrl">The absolute URL.</param>
/// <returns></returns>
public static PageUrlData ParseUrl(string url)
public static PageUrlData ParseUrl(string absoluteUrl)
{
UrlKind urlKind;
return ParseUrl(url, out urlKind);
return ParseUrl(absoluteUrl, out urlKind);
}

/// <summary>
/// Parses the URL.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="absoluteUrl">The absolute URL.</param>
/// <param name="urlKind">Kind of the URL.</param>
/// <returns></returns>
public static PageUrlData ParseUrl(string url, out UrlKind urlKind)
public static PageUrlData ParseUrl(string absoluteUrl, out UrlKind urlKind)
{
if (url.StartsWith("http") && url.Contains("://"))
if (absoluteUrl.StartsWith("http") && absoluteUrl.Contains("://"))
{
return UrlProvider.ParseUrl(url, out urlKind);
return UrlProvider.ParseUrl(absoluteUrl, out urlKind);
}

return UrlProvider.ParseUrl(url, new UrlSpace(), out urlKind);
return UrlProvider.ParseUrl(absoluteUrl, new UrlSpace(), out urlKind);
}

/// <summary>
/// Parses the URL.
/// </summary>
/// <param name="url">The URL.</param>
/// <param name="relativeUrl">The relative URL.</param>
/// <param name="urlSpace">The URL space.</param>
/// <param name="urlKind">Kind of the URL.</param>
/// <returns></returns>
public static PageUrlData ParseUrl(string url, UrlSpace urlSpace, out UrlKind urlKind)
public static PageUrlData ParseUrl(string relativeUrl, UrlSpace urlSpace, out UrlKind urlKind)
{
return UrlProvider.ParseUrl(url, urlSpace, out urlKind);
return UrlProvider.ParseUrl(relativeUrl, urlSpace, out urlKind);
}

/// <summary>
Expand Down
8 changes: 5 additions & 3 deletions Composite/Core/Routing/UrlSpace.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Web;
using System;
using System.Web;
using Composite.Plugins.Routing.Pages;

namespace Composite.Core.Routing
Expand Down Expand Up @@ -33,7 +34,6 @@ public UrlSpace()
}
}


/// <summary>
/// Initializes a new instance of the <see cref="UrlSpace"/> class.
/// </summary>
Expand All @@ -54,7 +54,9 @@ public UrlSpace(HttpContextBase httpContextBase)
{
Verify.ArgumentNotNull(httpContextBase, "httpContextBase");

Initialize(httpContextBase.Request.Url.Host, httpContextBase.Request.Url.LocalPath);
var url = httpContextBase.Request.Url;

Initialize(url.Host, url.LocalPath);
}

private void InitializeThroughHttpContext(HttpContext httpContext)
Expand Down
3 changes: 2 additions & 1 deletion Website/Composite/services/Tree/TreeServices.asmx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ namespace Composite.Services
public string GetEntityTokenByPageUrl(string pageUrl)
{
UrlKind urlKind;
PageUrlData pageUrlData = PageUrls.ParseUrl(pageUrl, new UrlSpace(HttpContext.Current), out urlKind);

PageUrlData pageUrlData = PageUrls.ParseUrl(pageUrl, out urlKind);
if (pageUrlData == null) return string.Empty;

if (pageUrlData.PublicationScope == PublicationScope.Published)
Expand Down

0 comments on commit 62b1615

Please sign in to comment.