mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-06-28 15:34:39 +08:00
Added StringComparer and forced lowercase where needed to ensure matching paths to ignore casing. (#8743)
This commit is contained in:
parent
e013e00dd4
commit
d943fbd83e
@ -186,7 +186,7 @@ namespace Orchard.Autoroute.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string GenerateUniqueSlug(AutoroutePart part, IEnumerable<string> existingPaths) {
|
public string GenerateUniqueSlug(AutoroutePart part, IEnumerable<string> existingPaths) {
|
||||||
if (existingPaths == null || !existingPaths.Contains(part.Path))
|
if (existingPaths == null || !existingPaths.Contains(part.Path, StringComparer.OrdinalIgnoreCase))
|
||||||
return part.Path;
|
return part.Path;
|
||||||
|
|
||||||
var version = existingPaths.Select(s => GetSlugVersion(part.Path, s)).OrderBy(i => i).LastOrDefault();
|
var version = existingPaths.Select(s => GetSlugVersion(part.Path, s)).OrderBy(i => i).LastOrDefault();
|
||||||
@ -287,7 +287,8 @@ namespace Orchard.Autoroute.Services {
|
|||||||
|
|
||||||
private static int? GetSlugVersion(string path, string potentialConflictingPath) {
|
private static int? GetSlugVersion(string path, string potentialConflictingPath) {
|
||||||
int v;
|
int v;
|
||||||
var slugParts = potentialConflictingPath.Split(new[] { path }, StringSplitOptions.RemoveEmptyEntries);
|
// Matching needs to ignore case, so both paths are forced to lowercase.
|
||||||
|
var slugParts = potentialConflictingPath.ToLower().Split(new[] { path.ToLower() }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
if (slugParts.Length == 0)
|
if (slugParts.Length == 0)
|
||||||
return 2;
|
return 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user