Skip to content

Commit 2ed6b80

Browse files
authored
V17/block encoding (#963)
* revert the encoding of blocks from #955 - because that breaks rendering as per #958 * Add Null checks to health check (cause it can load without the services). * v17.3.4 - package files.
1 parent b7b2dd9 commit 2ed6b80

7 files changed

Lines changed: 22 additions & 29 deletions

File tree

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<PackageVersion Include="Umbraco.Cms.DevelopmentMode.Backoffice" Version="17.4.2" />
99
<PackageVersion Include="Our.Umbraco.ConditionalDisplayers" Version="16.6.0" />
1010
<PackageVersion Include="Microsoft.ICU.ICU4C.Runtime" Version="72.1.0.3" />
11+
<PackageVersion Include="Clean" Version="7.0.5" />
1112
<PackageVersion Include="Clean.Core" Version="7.0.5" />
1213
</ItemGroup>
1314
<!-- umbraco libraries for packages -->

uSync.BackOffice/HealthChecks/SyncFolderIntegrityChecks.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Threading.Tasks;
56
using System.Xml.Linq;
67

@@ -23,7 +24,6 @@ public class SyncFolderIntegrityChecks : HealthCheck
2324
private readonly ISyncConfigService? _configService;
2425
private readonly ISyncFileService? _fileService;
2526

26-
2727
public SyncFolderIntegrityChecks() { }
2828

2929
/// <summary>
@@ -44,17 +44,8 @@ public override HealthCheckStatus ExecuteAction(HealthCheckAction action)
4444
/// <inheritdoc/>
4545
public override Task<IEnumerable<HealthCheckStatus>> GetStatusAsync()
4646
{
47-
if (_configService is null || _fileService is null)
48-
{
49-
return Task.FromResult((IEnumerable<HealthCheckStatus>)new List<HealthCheckStatus>
50-
{
51-
new HealthCheckStatus("uSync services not available")
52-
{
53-
Description = "The uSync services are not available, this likely means the site has no backoffice loaded.",
54-
ResultType = StatusResultType.Info
55-
}
56-
});
57-
}
47+
if (_configService is null || _fileService is null)
48+
return Task.FromResult(Enumerable.Empty<HealthCheckStatus>());
5849

5950
var items = new List<HealthCheckStatus>
6051
{
@@ -67,6 +58,9 @@ public override Task<IEnumerable<HealthCheckStatus>> GetStatusAsync()
6758

6859
private HealthCheckStatus CheckuSyncFolder()
6960
{
61+
if (_configService is null || _fileService is null)
62+
return new HealthCheckStatus("Unable to check uSync folder integrity");
63+
7064
var root = _fileService.GetAbsPath(_configService.GetWorkingFolder());
7165

7266
if (_fileService.DirectoryExists(root) is false)
@@ -100,6 +94,8 @@ private HealthCheckStatus CheckuSyncFolder()
10094

10195
private List<string> CheckFolder(string folder)
10296
{
97+
if (_fileService is null) return [];
98+
10399
var _keys = new Dictionary<Guid, string>();
104100

105101
var clashes = new List<string>();
@@ -143,6 +139,9 @@ private List<string> CheckFolder(string folder)
143139

144140
private HealthCheckStatus CheckConfigFolderValidity()
145141
{
142+
if (_configService is null || _fileService is null)
143+
return new HealthCheckStatus("Unable to check uSync folder integrity");
144+
146145
var root = _fileService.GetAbsPath(_configService.GetWorkingFolder());
147146

148147
if (_fileService.DirectoryExists(root) is false)

uSync.Backoffice.Management.Client/usync-assets/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uSync.Backoffice.Management.Client/usync-assets/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"homepage": "https://jumoo.co.uk/uSync",
99
"license": "MPL-2.0",
1010
"type": "module",
11-
"version": "17.3.3",
11+
"version": "17.3.4",
1212
"main": "./dist/usync.js",
1313
"types": "./dist/index.d.ts",
1414
"module": "./dist/usync.js",

uSync.Core/Mapping/SyncBlockMapperBase.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,11 @@ public SyncBlockMapperBase(
6262
_logger.LogDebug("Importing block value for {PropertyEditorAlias} {valueType}", propertyType.PropertyEditorAlias, value?.GetType().Name ?? "blank");
6363

6464
var importString = SyncBlockMapperBase<TBlockValue>.GetStringValue(value) ?? string.Empty;
65-
var result = await _mapperCollection.Value.GetImportValueAsync(importString, propertyType, options);
6665

67-
// When the original value was a non-string JSON type (array, object, number, etc.),
68-
// convert string results back to JsonNode to preserve the correct JSON type
69-
// and prevent double-encoding when the block value is re-serialized.
70-
if (result is string stringResult && value.IsNonStringJsonValue())
71-
{
72-
return stringResult.ConvertStringToExpandedJson() ?? result;
73-
// return stringResult.ConvertToJsonNode() ?? result;
74-
}
75-
76-
return result;
66+
// revert this back to the old way - we don't expand the json we get back because umbraco is very
67+
// sensitve to what the exact format of the blocks is, and if we expand them, then calls during render
68+
// can return null.
69+
return await _mapperCollection.Value.GetImportValueAsync(importString, propertyType, options);
7770
}
7871

7972
private async Task<object?> GetExportProperty(object? value, IPropertyType? propertyType, SyncSerializerOptions options)

uSync.History/history-client/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uSync.History/history-client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "usync-history-client",
3-
"version": "17.3.3",
3+
"version": "17.3.4",
44
"licence": "Custom",
55
"description": "uSync history function",
66
"type": "module",

0 commit comments

Comments
 (0)