Skip to content

Commit

Permalink
Addressing compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
napernik committed Oct 2, 2020
1 parent 6304778 commit 8ca9f26
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public override System.Configuration.ConfigurationSection GetSection(string sect
{
configurationSection = configuration.GetSection(sectionName) as System.Configuration.ConfigurationSection;
}
catch (System.Configuration.ConfigurationException ex)
catch
{
// retry once
UpdateCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@

namespace Composite.Core.Routing.Pages
{
/// <summary>
/// A route handler that performs an HTTP redirect with response code 301 (Permanently moved).
/// </summary>
public class SeoFriendlyRedirectRouteHandler: IRouteHandler
{
private readonly string _redirectUrl;

/// <summary>
/// Creates a new instance of <see cref="SeoFriendlyRedirectRouteHandler"/>
/// </summary>
/// <param name="redirectUrl">The URL to redirect to.</param>
public SeoFriendlyRedirectRouteHandler(string redirectUrl)
{
_redirectUrl = redirectUrl;
}

/// <inheritdoc />
public IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new SeoFriendlyRedirectHttpHandler(_redirectUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ public class PageInternalUrlConverter: IInternalUrlConverter
{
private static readonly string LogTitle = nameof(PageInternalUrlConverter);

private readonly string[] _acceptedUrlPrefixes = { "page(", "Renderers/Page.aspx" };
private readonly string[] _acceptedUrlPrefixes = { "page(", "Renderers/Page.aspx" };

public IEnumerable<string> AcceptedUrlPrefixes { get { return _acceptedUrlPrefixes; } }
/// <inheritdoc />
public IEnumerable<string> AcceptedUrlPrefixes => _acceptedUrlPrefixes;

/// <inheritdoc />
public string ToPublicUrl(string internalPageUrl, UrlSpace urlSpace)
Expand Down
22 changes: 20 additions & 2 deletions Composite/Plugins/Routing/Pages/DefaultPageUrlProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ namespace Composite.Plugins.Routing.Pages
[ConfigurationElementType(typeof(NonConfigurablePageUrlProvider))]
public class DefaultPageUrlProvider: IPageUrlProvider
{
/// <summary>
/// Url fragment than indicates that the hostname should be ignored when resolving root page.
/// Used for internally by C1 console.
/// </summary>
public static readonly string UrlMarker_RelativeUrl = "/c1mode(relative)";

/// <summary>
/// URL fragment that indicates that "unpublished" version of the page should be shown.
/// </summary>
public static readonly string UrlMarker_Unpublished = "/c1mode(unpublished)";

private static readonly string InternalUrlPrefix = "~/page(";
Expand Down Expand Up @@ -61,6 +69,9 @@ static DefaultPageUrlProvider()
}


/// <summary>
/// Creates a new instance of <see cref="DefaultPageUrlProvider" />
/// </summary>
public DefaultPageUrlProvider()
{
LoadUrlSuffix();
Expand All @@ -72,6 +83,8 @@ private static void LoadUrlSuffix()
.Select(c => c.PageUrlSuffix).FirstOrDefault() ?? string.Empty;
}


/// <inheritdoc />
[Obsolete]
public IPageUrlBuilder CreateUrlBuilder(PublicationScope publicationScope, CultureInfo localizationScope, UrlSpace urlSpace)
{
Expand Down Expand Up @@ -101,6 +114,7 @@ private static IReadOnlyCollection<IHostnameBinding> GetHostnameBindings()
return result;
}

/// <inheritdoc />
public bool IsInternalUrl(string relativeUrl)
{
string decodedRelativeUrl = HttpUtility.UrlDecode(relativeUrl);
Expand All @@ -115,10 +129,10 @@ internal static bool IsPageRendererRequest(string filePath)
return filePath.EndsWith("Renderers/Page.aspx", true);
}

/// <inheritdoc />
public PageUrlData ParseInternalUrl(string relativeUrl)
{
UrlKind urlKind;
return ParseInternalUrl(relativeUrl, out urlKind);
return ParseInternalUrl(relativeUrl, out _);
}

private PageUrlData ParseInternalUrl(string relativeUrl, out UrlKind urlKind)
Expand Down Expand Up @@ -257,6 +271,7 @@ private static PageUrlData ParseRendererUrl(UrlBuilder urlBuilder)
};
}

/// <inheritdoc />
public PageUrlData ParseUrl(string absoluteUrl, out UrlKind urlKind)
{
Verify.ArgumentNotNullOrEmpty(absoluteUrl, "absoluteUrl");
Expand Down Expand Up @@ -305,6 +320,7 @@ private bool IsKnownHostname(string hostname)
return GetHostnameBindings().Any(b => b.Hostname == hostname);
}

/// <inheritdoc />
public PageUrlData ParseUrl(string relativeUrl, UrlSpace urlSpace, out UrlKind urlKind)
{
if (IsInternalUrl(relativeUrl))
Expand Down Expand Up @@ -565,6 +581,7 @@ private IPage TryGetPageByUrlTitlePath(string pagePath, bool pathInfoExtracted,
return currentPage;
}

/// <xmlignore />
protected virtual IPage FindMatchingPage(Guid parentId, string urlTitle)
{
foreach (var page in GetChildPages(parentId))
Expand Down Expand Up @@ -672,6 +689,7 @@ internal static CultureInfo GetCultureInfo(string requestPath, IHostnameBinding
return DataLocalizationFacade.DefaultUrlMappingCulture;
}

/// <inheritdoc />
public string BuildUrl(PageUrlData pageUrlData, UrlKind urlKind, UrlSpace urlSpace)
{
Verify.ArgumentCondition(urlKind != UrlKind.Undefined, "urlKind", "Url kind is undefined");
Expand Down

0 comments on commit 8ca9f26

Please sign in to comment.