Replace uppercase chars to make behaviour consistent

This commit is contained in:
Bjarne Fyrstenborg
2022-08-16 21:31:51 +02:00
committed by Michael Latouche
parent 47f77b60a6
commit 68cf801689
2 changed files with 34 additions and 29 deletions

View File

@@ -19,30 +19,36 @@ public class RequestHandlerSettings
internal static readonly CharItem[] DefaultCharCollection =
{
new () { Char = " ", Replacement = "-" },
new () { Char = "\"", Replacement = string.Empty },
new () { Char = "'", Replacement = string.Empty },
new () { Char = "%", Replacement = string.Empty },
new () { Char = ".", Replacement = string.Empty },
new () { Char = ";", Replacement = string.Empty },
new () { Char = "/", Replacement = string.Empty },
new () { Char = "\\", Replacement = string.Empty },
new () { Char = ":", Replacement = string.Empty },
new () { Char = "#", Replacement = string.Empty },
new () { Char = "+", Replacement = "plus" },
new () { Char = "*", Replacement = "star" },
new () { Char = "&", Replacement = string.Empty },
new () { Char = "?", Replacement = string.Empty },
new () { Char = "æ", Replacement = "ae" },
new () { Char = "ä", Replacement = "ae" },
new () { Char = "ø", Replacement = "oe" },
new () { Char = "ö", Replacement = "oe" },
new () { Char = "å", Replacement = "aa" },
new () { Char = "ü", Replacement = "ue" },
new () { Char = "ß", Replacement = "ss" },
new () { Char = "|", Replacement = "-" },
new () { Char = "<", Replacement = string.Empty },
new () { Char = ">", Replacement = string.Empty },
new() { Char = " ", Replacement = "-" },
new() { Char = "\"", Replacement = string.Empty },
new() { Char = "'", Replacement = string.Empty },
new() { Char = "%", Replacement = string.Empty },
new() { Char = ".", Replacement = string.Empty },
new() { Char = ";", Replacement = string.Empty },
new() { Char = "/", Replacement = string.Empty },
new() { Char = "\\", Replacement = string.Empty },
new() { Char = ":", Replacement = string.Empty },
new() { Char = "#", Replacement = string.Empty },
new() { Char = "&", Replacement = string.Empty },
new() { Char = "?", Replacement = string.Empty },
new() { Char = "<", Replacement = string.Empty },
new() { Char = ">", Replacement = string.Empty },
new() { Char = "+", Replacement = "plus" },
new() { Char = "*", Replacement = "star" },
new() { Char = "æ", Replacement = "ae" },
new() { Char = "Æ", Replacement = "ae" },
new() { Char = "ä", Replacement = "ae" },
new() { Char = "Ä", Replacement = "ae" },
new() { Char = "ø", Replacement = "oe" },
new() { Char = "Ø", Replacement = "oe" },
new() { Char = "ö", Replacement = "oe" },
new() { Char = "Ö", Replacement = "oe" },
new() { Char = "å", Replacement = "aa" },
new() { Char = "Å", Replacement = "aa" },
new() { Char = "ü", Replacement = "ue" },
new() { Char = "Ü", Replacement = "ue" },
new() { Char = "ß", Replacement = "ss" },
new() { Char = "|", Replacement = "-" },
};
/// <summary>

View File

@@ -7,13 +7,13 @@ namespace Umbraco.Extensions;
/// <summary>
/// Get concatenated user and default character replacements
/// taking into account <see cref="RequestHandlerSettings.EnableDefaultCharReplacements" />
/// taking into account <see cref="RequestHandlerSettings.EnableDefaultCharReplacements" />.
/// </summary>
public static class RequestHandlerSettingsExtension
{
/// <summary>
/// Get concatenated user and default character replacements
/// taking into account <see cref="RequestHandlerSettings.EnableDefaultCharReplacements" />
/// taking into account <see cref="RequestHandlerSettings.EnableDefaultCharReplacements" />.
/// </summary>
public static IEnumerable<CharItem> GetCharReplacements(this RequestHandlerSettings requestHandlerSettings)
{
@@ -34,7 +34,7 @@ public static class RequestHandlerSettingsExtension
}
/// <summary>
/// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection
/// Merges CharCollection and UserDefinedCharCollection, prioritizing UserDefinedCharCollection.
/// </summary>
internal static void MergeReplacements(
this RequestHandlerSettings requestHandlerSettings,
@@ -71,8 +71,7 @@ public static class RequestHandlerSettingsExtension
}
/// <summary>
/// Merges two IEnumerable of CharItem without any duplicates, items in priorityReplacements will override those in
/// alternativeReplacements
/// Merges two IEnumerable of CharItem without any duplicates, items in priorityReplacements will override those in alternativeReplacements.
/// </summary>
private static IEnumerable<CharItem> MergeUnique(
IEnumerable<CharItem> priorityReplacements,