Skip to content

Commit 1b97a54

Browse files
committed
ensuring source and destination structure is exactly the same for transferred content.
1 parent 6578f97 commit 1b97a54

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Umbraco.Deploy.Contrib.Connectors/ValueConnectors/BlockEditorValueConnector.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,16 @@ public BlockEditorValueConnector(IContentTypeService contentTypeService, Lazy<Va
4040
public string ToArtifact(object value, PropertyType propertyType, ICollection<ArtifactDependency> dependencies)
4141
{
4242
var svalue = value as string;
43+
44+
// nested values will arrive here as JObject - convert to string to enable reuse of same code as when non-nested.
45+
if (value is JObject)
46+
svalue = value.ToString();
47+
4348
if (string.IsNullOrWhiteSpace(svalue))
4449
return null;
4550

4651
if (svalue.DetectIsJson() == false)
4752
return null;
48-
4953
var blockEditorValue = JsonConvert.DeserializeObject<BlockEditorValue>(svalue);
5054

5155
if (blockEditorValue == null)
@@ -178,8 +182,7 @@ public object FromArtifact(string value, PropertyType propertyType, object curre
178182
}
179183
}
180184

181-
value = JsonConvert.SerializeObject(blockEditorValue);
182-
return value;
185+
return JObject.FromObject(blockEditorValue);
183186
}
184187

185188
/// <summary>

0 commit comments

Comments
 (0)