Add ASCII file name conversion (#17580)
(cherry picked from commit4590739fa5) (cherry picked from commit3d1505d4c6)
This commit is contained in:
@@ -74,12 +74,21 @@ public class DefaultShortStringHelperConfig
|
||||
{
|
||||
urlSegmentConvertTo = CleanStringType.Ascii;
|
||||
}
|
||||
|
||||
if (requestHandlerSettings.ShouldTryConvertUrlsToAscii)
|
||||
else if (requestHandlerSettings.ShouldTryConvertUrlsToAscii)
|
||||
{
|
||||
urlSegmentConvertTo = CleanStringType.TryAscii;
|
||||
}
|
||||
|
||||
CleanStringType fileNameSegmentConvertTo = CleanStringType.Utf8;
|
||||
if (requestHandlerSettings.ShouldConvertFileNamesToAscii)
|
||||
{
|
||||
fileNameSegmentConvertTo = CleanStringType.Ascii;
|
||||
}
|
||||
else if (requestHandlerSettings.ShouldTryConvertFileNamesToAscii)
|
||||
{
|
||||
fileNameSegmentConvertTo = CleanStringType.TryAscii;
|
||||
}
|
||||
|
||||
return WithConfig(CleanStringType.UrlSegment, new Config
|
||||
{
|
||||
PreFilter = ApplyUrlReplaceCharacters,
|
||||
@@ -92,7 +101,7 @@ public class DefaultShortStringHelperConfig
|
||||
{
|
||||
PreFilter = ApplyUrlReplaceCharacters,
|
||||
IsTerm = (c, leading) => char.IsLetterOrDigit(c) || c == '_', // letter, digit or underscore
|
||||
StringType = CleanStringType.Utf8 | CleanStringType.LowerCase,
|
||||
StringType = fileNameSegmentConvertTo | CleanStringType.LowerCase,
|
||||
BreakTermsOnUpper = false,
|
||||
Separator = '-',
|
||||
}).WithConfig(CleanStringType.Alias, new Config
|
||||
|
||||
Reference in New Issue
Block a user