removes ForceSafeAliases from umbraco settings, etc...

This commit is contained in:
Shannon
2019-01-30 23:58:54 +11:00
parent 3dce2c870e
commit f1b168fc46
11 changed files with 6 additions and 57 deletions

View File

@@ -25,9 +25,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
[ConfigurationProperty("PropertyContextHelpOption")]
internal InnerTextConfigurationElement<string> PropertyContextHelpOption => GetOptionalTextElement("PropertyContextHelpOption", "text");
[ConfigurationProperty("ForceSafeAliases")]
internal InnerTextConfigurationElement<bool> ForceSafeAliases => GetOptionalTextElement("ForceSafeAliases", true);
[ConfigurationProperty("PreviewBadge")]
internal InnerTextConfigurationElement<string> PreviewBadge => GetOptionalTextElement("PreviewBadge", DefaultPreviewBadge);
@@ -73,8 +70,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
string IContentSection.PropertyContextHelpOption => PropertyContextHelpOption;
bool IContentSection.ForceSafeAliases => ForceSafeAliases;
string IContentSection.PreviewBadge => PreviewBadge;
MacroErrorBehaviour IContentSection.MacroErrorBehaviour => MacroErrors;

View File

@@ -19,8 +19,6 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
string PropertyContextHelpOption { get; }
bool ForceSafeAliases { get; }
string PreviewBadge { get; }
MacroErrorBehaviour MacroErrorBehaviour { get; }

View File

@@ -51,8 +51,7 @@ namespace Umbraco.Core.Services.Implement
{
if (content == null) throw new ArgumentNullException(nameof(content));
// nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck();
var nodeName = content.ContentType.Alias.ToSafeAlias();
var xml = SerializeContentBase(content, content.GetUrlSegment(_urlSegmentProviders), nodeName, published);
@@ -98,8 +97,7 @@ namespace Umbraco.Core.Services.Implement
if (media == null) throw new ArgumentNullException(nameof(media));
if (_urlSegmentProviders == null) throw new ArgumentNullException(nameof(_urlSegmentProviders));
// nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck();
var nodeName = media.ContentType.Alias.ToSafeAlias();
const bool published = false; // always false for media
var xml = SerializeContentBase(media, media.GetUrlSegment(_urlSegmentProviders), nodeName, published);
@@ -134,8 +132,7 @@ namespace Umbraco.Core.Services.Implement
/// </summary>
public XElement Serialize(IMember member)
{
// nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias);
var nodeName = member.ContentType.Alias.ToSafeAliasWithForcingCheck();
var nodeName = member.ContentType.Alias.ToSafeAlias();
const bool published = false; // always false for member
var xml = SerializeContentBase(member, "", nodeName, published);

View File

@@ -1108,29 +1108,6 @@ namespace Umbraco.Core
return Current.ShortStringHelper.CleanStringForSafeAlias(alias, culture);
}
/// <summary>
/// Cleans (but only if required) a string to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <returns>The safe alias.</returns>
/// <remarks>Checks <c>UmbracoSettings.ForceSafeAliases</c> to determine whether it should filter the text.</remarks>
public static string ToSafeAliasWithForcingCheck(this string alias)
{
return Current.Configs.Settings().Content.ForceSafeAliases ? alias.ToSafeAlias() : alias;
}
/// <summary>
/// Cleans (but only if required) a string, in the context of a specified culture, to produce a string that can safely be used in an alias.
/// </summary>
/// <param name="alias">The text to filter.</param>
/// <param name="culture">The culture.</param>
/// <returns>The safe alias.</returns>
/// <remarks>Checks <c>UmbracoSettings.ForceSafeAliases</c> to determine whether it should filter the text.</remarks>
public static string ToSafeAliasWithForcingCheck(this string alias, string culture)
{
return Current.Configs.Settings().Content.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias;
}
// the new methods to get a url segment
/// <summary>

View File

@@ -14,7 +14,6 @@ namespace Umbraco.Core.Strings
var config = new DefaultShortStringHelperConfig
{
DefaultCulture = DefaultCulture,
ForceSafeAliases = ForceSafeAliases,
UrlReplaceCharacters = UrlReplaceCharacters
};
@@ -31,9 +30,7 @@ namespace Umbraco.Core.Strings
public string DefaultCulture { get; set; } = ""; // invariant
public Dictionary<string, string> UrlReplaceCharacters { get; set; }
public bool ForceSafeAliases { get; set; }
public DefaultShortStringHelperConfig WithConfig(Config config)
{
return WithConfig(DefaultCulture, CleanStringType.RoleMask, config);
@@ -62,7 +59,6 @@ namespace Umbraco.Core.Strings
/// <returns>The short string helper.</returns>
public DefaultShortStringHelperConfig WithDefault(IUmbracoSettingsSection umbracoSettings)
{
ForceSafeAliases = umbracoSettings.Content.ForceSafeAliases;
UrlReplaceCharacters = umbracoSettings.RequestHandler.CharCollection
.Where(x => string.IsNullOrEmpty(x.Char) == false)
.ToDictionary(x => x.Char, x => x.Replacement);

View File

@@ -79,12 +79,6 @@ namespace Umbraco.Tests.Configurations.UmbracoSettings
{
Assert.IsTrue(SettingsSection.Content.CloneXmlContent);
}
[Test]
public void ForceSafeAliases()
{
Assert.IsTrue(SettingsSection.Content.ForceSafeAliases);
}
[Test]
public void PropertyContextHelpOption()

View File

@@ -48,8 +48,6 @@
<cloneXmlContent>true</cloneXmlContent>
<ForceSafeAliases>true</ForceSafeAliases>
<PreviewBadge>
<![CDATA[
<a id="umbracoPreviewBadge" style="z-index:99999; position: absolute; top: 0; right: 0; border: 0; width: 149px; height: 149px; background: url('{0}/assets/img/preview-mode-badge.png') no-repeat;" href="#" OnClick="javascript:window.top.location.href = '{0}/preview/end?redir={1}'"><span style="display:none;">In Preview Mode - click to end</span></a>

View File

@@ -27,7 +27,7 @@ namespace Umbraco.Tests.Models
var content = MockedContent.CreateTextpageContent(contentType, "Root Home", -1);
ServiceContext.ContentService.Save(content, Constants.Security.SuperUserId);
var nodeName = content.ContentType.Alias.ToSafeAliasWithForcingCheck();
var nodeName = content.ContentType.Alias.ToSafeAlias();
var urlName = content.GetUrlSegment(new[]{new DefaultUrlSegmentProvider() });
// Act

View File

@@ -47,7 +47,7 @@ namespace Umbraco.Tests.Models
media.SetValue(Constants.Conventions.Media.Bytes, "100");
media.SetValue(Constants.Conventions.Media.Extension, "png");
var nodeName = media.ContentType.Alias.ToSafeAliasWithForcingCheck();
var nodeName = media.ContentType.Alias.ToSafeAlias();
var urlName = media.GetUrlSegment(new[] { new DefaultUrlSegmentProvider() });
// Act

View File

@@ -51,7 +51,6 @@ namespace Umbraco.Tests.TestHelpers
settings.Setup(x => x.WebRouting).Returns(routing.Object);
//Now configure some defaults - the defaults in the config section classes do NOT pertain to the mocked data!!
settings.Setup(x => x.Content.ForceSafeAliases).Returns(true);
settings.Setup(x => x.Content.ImageAutoFillProperties).Returns(ContentImagingElement.GetDefaultImageAutoFillProperties());
settings.Setup(x => x.Content.ImageFileTypes).Returns(ContentImagingElement.GetDefaultImageFileTypes());
settings.Setup(x => x.RequestHandler.AddTrailingSlash).Returns(true);

View File

@@ -39,11 +39,6 @@
<email>your@email.here</email>
</notifications>
<!-- Whether to force safe aliases (no spaces, no special characters) at businesslogic level on contenttypes and propertytypes -->
<!-- HIGHLY recommend to keep this to true to ensure valid and beautiful XML Schemas -->
<!-- fixme: remove this -->
<ForceSafeAliases>true</ForceSafeAliases>
<!-- Show property descriptions in editing view "icon|text|none" -->
<PropertyContextHelpOption>text</PropertyContextHelpOption>