diff --git a/build/NuSpecs/tools/Web.config.cloud.xdt b/build/NuSpecs/tools/Web.config.cloud.xdt new file mode 100644 index 0000000000..988c741126 --- /dev/null +++ b/build/NuSpecs/tools/Web.config.cloud.xdt @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/build.ps1 b/build/build.ps1 index ea0a50e5b1..ff24079532 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -92,6 +92,7 @@ $src = "$($this.SolutionRoot)\src" $log = "$($this.BuildTemp)\belle.log" + Write-Host "Compile Belle" Write-Host "Logging to $log" @@ -555,7 +556,6 @@ # run if (-not $get) { -cd if ($command.Length -eq 0) { $command = @( "Build" ) diff --git a/src/Umbraco.Core/PropertyEditors/DataEditor.cs b/src/Umbraco.Core/PropertyEditors/DataEditor.cs index c8b9f3a51f..e2fc0071be 100644 --- a/src/Umbraco.Core/PropertyEditors/DataEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/DataEditor.cs @@ -21,7 +21,6 @@ namespace Umbraco.Cms.Core.PropertyEditors public class DataEditor : IDataEditor { private IDictionary _defaultConfiguration; - private IDataValueEditor _reusableEditor; /// /// Initializes a new instance of the class. @@ -90,8 +89,7 @@ namespace Umbraco.Cms.Core.PropertyEditors /// simple enough for now. /// // TODO: point of that one? shouldn't we always configure? - public IDataValueEditor GetValueEditor() => ExplicitValueEditor ?? (_reusableEditor ?? (_reusableEditor = CreateValueEditor())); - + public IDataValueEditor GetValueEditor() => ExplicitValueEditor ?? CreateValueEditor(); /// /// diff --git a/src/Umbraco.Infrastructure/Persistence/LocalDb.cs b/src/Umbraco.Infrastructure/Persistence/LocalDb.cs index 0ca98d2b14..0dbe84b07a 100644 --- a/src/Umbraco.Infrastructure/Persistence/LocalDb.cs +++ b/src/Umbraco.Infrastructure/Persistence/LocalDb.cs @@ -927,6 +927,7 @@ namespace Umbraco.Cms.Infrastructure.Persistence return p.ExitCode; } + } /// diff --git a/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyHandler.cs b/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyHandler.cs index 24c9b37cde..9a7ecdbf29 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyHandler.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/BlockEditorPropertyHandler.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Umbraco.Cms.Core.Models.Blocks; @@ -17,6 +18,12 @@ namespace Umbraco.Cms.Core.PropertyEditors public class BlockEditorPropertyHandler : ComplexPropertyEditorContentNotificationHandler { private readonly BlockListEditorDataConverter _converter = new BlockListEditorDataConverter(); + private readonly ILogger _logger; + + public BlockEditorPropertyHandler(ILogger logger) + { + _logger = logger; + } protected override string EditorAlias => Constants.PropertyEditors.Aliases.BlockList; @@ -110,8 +117,22 @@ namespace Umbraco.Cms.Core.PropertyEditors // this gets a little ugly because there could be some other complex editor that contains another block editor // and since we would have no idea how to parse that, all we can do is try JSON Path to find another block editor // of our type - var json = JToken.Parse(asString); - if (ProcessJToken(json, createGuid, out var result)) + JToken json = null; + try + { + json = JToken.Parse(asString); + } + catch (Exception e) + { + // See issue https://github.com/umbraco/Umbraco-CMS/issues/10879 + // We are detecting JSON data by seeing if a string is surrounded by [] or {} + // If people enter text like [PLACEHOLDER] JToken parsing fails, it's safe to ignore though + // Logging this just in case in the future we find values that are not safe to ignore + _logger.LogWarning( "The property {PropertyAlias} on content type {ContentTypeKey} has a value of: {BlockItemValue} - this was recognized as JSON but could not be parsed", + data.Key, propertyAliasToBlockItemData.Key, asString); + } + + if (json != null && ProcessJToken(json, createGuid, out var result)) { // need to re-save this back to the RawPropertyValues data.RawPropertyValues[propertyAliasToBlockItemData.Key] = result; diff --git a/src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockEditorComponentTests.cs b/src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockEditorComponentTests.cs index 590ff58222..b76719888f 100644 --- a/src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockEditorComponentTests.cs +++ b/src/Umbraco.Tests.UnitTests/Umbraco.Core/PropertyEditors/BlockEditorComponentTests.cs @@ -4,6 +4,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Microsoft.Extensions.Logging; +using Moq; using Newtonsoft.Json; using NUnit.Framework; using Umbraco.Cms.Core; @@ -28,11 +30,15 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors private const string SubContentGuid1 = "4c44ce6b3a5c4f5f8f15e3dc24819a9e"; private const string SubContentGuid2 = "a062c06d6b0b44ac892b35d90309c7f8"; private const string SubSettingsGuid1 = "4d998d980ffa4eee8afdc23c4abd6d29"; + private static readonly ILogger s_logger = Mock.Of>(); + + + [Test] public void Cannot_Have_Null_Udi() { - var component = new BlockEditorPropertyHandler(); + var component = new BlockEditorPropertyHandler(s_logger); var json = GetBlockListJson(null, string.Empty); Assert.Throws(() => component.ReplaceBlockListUdis(json)); } @@ -48,7 +54,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors var expected = ReplaceGuids(json, guids, ContentGuid1, ContentGuid2, SettingsGuid1); - var component = new BlockEditorPropertyHandler(); + var component = new BlockEditorPropertyHandler(s_logger); var result = component.ReplaceBlockListUdis(json, GuidFactory); var expectedJson = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(expected, _serializerSettings), _serializerSettings); @@ -75,7 +81,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors // get the json with the subFeatures as escaped var json = GetBlockListJson(innerJsonEscaped); - var component = new BlockEditorPropertyHandler(); + var component = new BlockEditorPropertyHandler(s_logger); var result = component.ReplaceBlockListUdis(json, GuidFactory); // the expected result is that the subFeatures data is no longer escaped @@ -119,7 +125,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors SubContentGuid2, SubSettingsGuid1); - var component = new BlockEditorPropertyHandler(); + var component = new BlockEditorPropertyHandler(s_logger); var result = component.ReplaceBlockListUdis(json, GuidFactory); var expectedJson = JsonConvert.SerializeObject(JsonConvert.DeserializeObject(expected, _serializerSettings), _serializerSettings); @@ -147,7 +153,7 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.PropertyEditors var json = GetBlockListJson(complexEditorJsonEscaped); - var component = new BlockEditorPropertyHandler(); + var component = new BlockEditorPropertyHandler(s_logger); var result = component.ReplaceBlockListUdis(json, GuidFactory); // the expected result is that the subFeatures data is no longer escaped diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js index 358223901e..a39475f4da 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/tree/umbtree.directive.js @@ -3,7 +3,7 @@ * @name umbraco.directives.directive:umbTree * @restrict E **/ -function umbTreeDirective($q, treeService, navigationService, notificationsService) { +function umbTreeDirective($q, treeService, notificationsService) { return { restrict: 'E', @@ -357,8 +357,6 @@ function umbTreeDirective($q, treeService, navigationService, notificationsServi defined on the tree */ $scope.select = function (n, ev) { - - navigationService.hideMenu(); if (n.metaData && n.metaData.noAccess === true) { ev.preventDefault(); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js index 88894ac47a..b6609a73fc 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js @@ -127,7 +127,7 @@ function navigationService($routeParams, $location, $q, $injector, eventsService var aboveClass = "above-backdrop"; var leftColumn = document.getElementById("leftcolumn"); - if(leftColumn) { + if (leftColumn) { var isLeftColumnOnTop = leftColumn.classList.contains(aboveClass); if (isLeftColumnOnTop) { diff --git a/src/Umbraco.Web.UI.Client/src/less/property-editors.less b/src/Umbraco.Web.UI.Client/src/less/property-editors.less index 87603671dd..b735b6d7e4 100644 --- a/src/Umbraco.Web.UI.Client/src/less/property-editors.less +++ b/src/Umbraco.Web.UI.Client/src/less/property-editors.less @@ -585,7 +585,6 @@ display: inline-block; position: relative; vertical-align: top; - flex:0; } .umb-fileupload,