Skip to content
This repository was archived by the owner on Feb 10, 2024. It is now read-only.

Commit 83e61bf

Browse files
committed
Workaround for issue #43
We found that Umbraco's Tags property-editor doesn't convert/prepare the DB value as expected. We have raised an issue on the Umbraco tracker here: http://issues.umbraco.org/issue/U4-8279
1 parent 966eacb commit 83e61bf

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

src/Our.Umbraco.DocTypeGridEditor/Helpers/DocTypeGridEditorHelper.cs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Our.Umbraco.DocTypeGridEditor.Extensions;
77
using Our.Umbraco.DocTypeGridEditor.Models;
88
using Umbraco.Core;
9+
using Umbraco.Core.Logging;
910
using Umbraco.Core.Models;
1011
using Umbraco.Core.Models.Editors;
1112
using Umbraco.Core.Models.PublishedContent;
@@ -78,10 +79,30 @@ private static IPublishedContent ConvertValue(string id, string contentTypeAlias
7879
* XML serialized state as expected by the published property by calling ConvertDbToString
7980
*/
8081
var propType2 = contentType.CompositionPropertyTypes.Single(x => x.Alias == propType.PropertyTypeAlias);
81-
var newValue2 = propEditor.ValueEditor.ConvertDbToString(new Property(propType2, newValue), propType2,
82-
ApplicationContext.Current.Services.DataTypeService);
8382

84-
properties.Add(new DetachedPublishedProperty(propType, newValue2));
83+
Property prop2 = null;
84+
try
85+
{
86+
/* HACK: [LK:2016-04-01] When using the "Umbraco.Tags" property-editor, the converted DB value does
87+
* not match the datatypes underlying db-column type. So it throws a "Type validation failed" exception.
88+
* We feel that the Umbraco core isn't handling the Tags value correctly, as it should be the responsiblity
89+
* of the "Umbraco.Tags" property-editor to handle the value conversion into the correct type.
90+
* See: http://issues.umbraco.org/issue/U4-8279
91+
*/
92+
prop2 = new Property(propType2, newValue);
93+
}
94+
catch(Exception ex)
95+
{
96+
LogHelper.Error<DocTypeGridEditorHelper>("Error creating Property object.", ex);
97+
}
98+
99+
if (prop2 != null)
100+
{
101+
var newValue2 = propEditor.ValueEditor.ConvertDbToString(prop2, propType2,
102+
ApplicationContext.Current.Services.DataTypeService);
103+
104+
properties.Add(new DetachedPublishedProperty(propType, newValue2));
105+
}
85106
}
86107
}
87108

0 commit comments

Comments
 (0)