Remove ugly CharCollection hack
By adding a new configuration and mapping the old CharCollection to that, we can get around having to return null the first time, by obsoleting the old one and redirecting to the new GetCharReplacements method
This commit is contained in:
@@ -61,16 +61,7 @@ namespace Umbraco.Cms.Core.Strings
|
||||
/// <returns>The short string helper.</returns>
|
||||
public DefaultShortStringHelperConfig WithDefault(RequestHandlerSettings requestHandlerSettings)
|
||||
{
|
||||
// CharCollection could potentially be null if not invoked first by the framework, for instance in tests, so ensure that it's initialized.
|
||||
IEnumerable<IChar> charCollection = requestHandlerSettings.CharCollection;
|
||||
if (charCollection is null)
|
||||
{
|
||||
charCollection = requestHandlerSettings.CharCollection;
|
||||
if (charCollection is null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(requestHandlerSettings.CharCollection));
|
||||
}
|
||||
}
|
||||
IEnumerable<IChar> charCollection = requestHandlerSettings.GetCharReplacements();
|
||||
|
||||
UrlReplaceCharacters = charCollection
|
||||
.Where(x => string.IsNullOrEmpty(x.Char) == false)
|
||||
|
||||
Reference in New Issue
Block a user