U4-9974 - EnablePropertyValueConverter does the opposite in 7.6.2

Created by Sebastiaan Janssen 01 Jun 2017, 08:56:32 Updated by Mike Chambers 06 Jun 2017, 13:24:52

Relates to: U4-9894

For types:

  • LegacyRelatedLinks
  • RelatedLinks
  • MultiNodeTreePicker
  • MemberPicker

Plus the media picker is missing a check for the obsolete media picker.

Comments

Sebastiaan Janssen 01 Jun 2017, 08:57:59

PR https://github.com/umbraco/Umbraco-CMS/pull/1969


Mike Chambers 06 Jun 2017, 11:47:47

I was hoping that this was going to resolve the support for the legacyMediaPicker aka umbraco.mediaPicker but am finding that rather than an asp.net null reference exception that we got in 7.6.2 now seeing

Exception Details: System.FormatException: String "2728" is not a valid udi.

forum post on OUR https://our.umbraco.org/forum/templates-partial-views-and-macros/86156-string-nnnn-is-not-a-valid-udi#comment-273193

suggests a work around, changing to umbraco.mediaPicker2 but that relies on being able to republish affected nodes eg not in an editing cycle :-(.

any quick solutions? maybe a branch of the core-value-property-convertors that only contains the umbraco.mediapicker one related to id's rather than udis?


Mike Chambers 06 Jun 2017, 13:24:52

ConvertSourceToObject only supports UDI's :-(

'''public override object ConvertSourceToObject(PublishedPropertyType propertyType, object source, bool preview) { if (source == null) { return null; }

        var udis = (Udi[])source;
        var mediaItems = new List<IPublishedContent>();
        if (UmbracoContext.Current == null) return source;
        var helper = new UmbracoHelper(UmbracoContext.Current);
        if (udis.Any())
        {
            foreach (var udi in udis)
            {
                var item = helper.TypedMedia(udi);
                if (item != null)
                    mediaItems.Add(item);
            }
            if (IsMultipleDataType(propertyType.DataTypeId, propertyType.PropertyEditorAlias))
            {
                return mediaItems;
            }
            else
            {
                return mediaItems.FirstOrDefault();
            }
        }

        return source;
    }'''


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.6.2

Due in version: 7.6.3

Sprint:

Story Points:

Cycle: 2