Skip to content

Commit 7982334

Browse files
authored
Merge pull request #33 from umbraco/bug/deploying-vorto-data-without-dtd
Deploying old vorto data
2 parents 5e9d801 + cbcd2ed commit 7982334

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Newtonsoft.Json.Linq;
66
using Umbraco.Core;
77
using Umbraco.Core.Deploy;
8+
using Umbraco.Core.Logging;
89
using Umbraco.Core.Models;
910
using Umbraco.Core.Services;
1011
using Umbraco.Deploy.ValueConnectors;
@@ -64,6 +65,13 @@ public string GetValue(Property property, ICollection<ArtifactDependency> depend
6465
if (vortoValue?.Values?.ValuePairs == null)
6566
return null;
6667

68+
// old versions of Vorto doesn't seem to store a DtdGuid - in those cases we just deploy the value as it is without any further handling.
69+
if (string.IsNullOrWhiteSpace(vortoValue.DtdGuid))
70+
{
71+
LogHelper.Debug<VortoValueConnector>($"No datatype definition defined inside the Vorto property: {property.Alias} - are you using an old version of Vorto? - data value will be deployed as it is.");
72+
return value;
73+
}
74+
6775
// get the Vorto datatype
6876
var vortoDataType = _dataTypeService.GetDataTypeDefinitionById(Guid.Parse(vortoValue.DtdGuid));
6977

@@ -135,6 +143,14 @@ public void SetValue(IContentBase content, string alias, string value)
135143
if (vortoValue == null)
136144
return;
137145

146+
// old versions of Vorto doesn't seem to store a DtdGuid - in those cases we just deploy the value as it is without any further handling.
147+
if (string.IsNullOrWhiteSpace(vortoValue.DtdGuid))
148+
{
149+
LogHelper.Debug<VortoValueConnector>($"No datatype definition defined inside the Vorto property: {alias} - are you using an old version of Vorto? - data value will be deployed as it is.");
150+
content.SetValue(alias, value);
151+
return;
152+
}
153+
138154
// getting the wrapped datatype via the Vorto datatype
139155
var vortoDataType = _dataTypeService.GetDataTypeDefinitionById(Guid.Parse(vortoValue.DtdGuid));
140156
var vortoDataTypePrevalueJson = _dataTypeService.GetPreValuesCollectionByDataTypeId(vortoDataType.Id).FormatAsDictionary().FirstOrDefault(x => x.Key == "dataType").Value.Value;

0 commit comments

Comments
 (0)