Added sperate option "IUrlHelper and support for RouteOptions.LowercaseUrls "
@rynowak #518 #Issue: https://github.com/aspnet/Mvc/issues/7720
This commit is contained in:
parent
695fb00308
commit
f227cbeca3
|
|
@ -139,7 +139,7 @@ namespace Microsoft.AspNetCore.Routing
|
|||
|
||||
var url = pathData.VirtualPath;
|
||||
|
||||
if (!string.IsNullOrEmpty(url) && (_options.LowercaseUrls || _options.AppendTrailingSlash))
|
||||
if (!string.IsNullOrEmpty(url) && (_options.LowercaseUrls || _options.LowercaseQueryStrings || _options.AppendTrailingSlash))
|
||||
{
|
||||
var indexOfSeparator = url.IndexOfAny(UrlQueryDelimiters);
|
||||
var urlWithoutQueryString = url;
|
||||
|
|
@ -154,11 +154,11 @@ namespace Microsoft.AspNetCore.Routing
|
|||
if (_options.LowercaseUrls)
|
||||
{
|
||||
urlWithoutQueryString = urlWithoutQueryString.ToLowerInvariant();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(queryString))
|
||||
{
|
||||
queryString = queryString.ToLowerInvariant();
|
||||
}
|
||||
if (_options.LowercaseQueryStrings)
|
||||
{
|
||||
queryString = queryString.ToLowerInvariant();
|
||||
}
|
||||
|
||||
if (_options.AppendTrailingSlash && !urlWithoutQueryString.EndsWith("/"))
|
||||
|
|
|
|||
|
|
@ -10,10 +10,15 @@ namespace Microsoft.AspNetCore.Routing
|
|||
public class RouteOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether all generated URLs are lower-case.
|
||||
/// Gets or sets a value indicating whether all generated URLs are lower-case. it doesn't include the query string.
|
||||
/// </summary>
|
||||
public bool LowercaseUrls { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether all generated QUERY STRINGS are lower-case.
|
||||
/// </summary>
|
||||
public bool LowercaseQueryStrings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether a trailing slash should be appended to the generated URLs.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Reference in New Issue