Incorrect validation for media items that do not have marketing assets

  • Description

    All media items under the Media Library root are considered as marketing items. An exception occurs when trying to upload, copy, create, rename, or save an item containing any other characters in the name except for letters, digits, dashes, or underscores. Marketing operation functionality enforces marketing item name restrictions that do not take into account the ItemNameValidation setting. The ItemEventHandler class does not check if media items have marketing assets before validation.

    For example:

    ManagedPoolThread #0 2018:10:23 12:58:48 ERROR One or more exceptions occurred while processing the subscribers to the 'item:creating' event.
    Exception[1]: System.ArgumentException 
    Message[1]: 'Name' should consist only of letters, digits, dashes or underscore 
    Source[1]: Sitecore.Marketing.Core 
       at Sitecore.Marketing.Core.Extensions.ConditionValidatorExtensions.IsValidAlias(ConditionValidator`1 validator)
       at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.ValidateItemName(ItemData itemData)
       at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.OnItemCreating(Object sender, EventArgs args)
       at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result) 
    5968 19:08:31 ERROR One or more exceptions occurred while processing the subscribers to the 'item:saving' event.
    Exception[1]: System.ArgumentException 
    Message[1]: 'Name' should consist only of letters, digits, dashes or underscore 
    Source[1]: Sitecore.Marketing.Core 
       at Sitecore.Marketing.Core.Extensions.ConditionValidatorExtensions.IsValidAlias(ConditionValidator`1 validator)
       at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.ValidateItemName(ItemData itemData)
       at Sitecore.Marketing.xMgmt.Definitions.ItemEventHandler.OnItemSaving(Object sender, EventArgs args)
       at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result) 

Applies to:

CMS 9.0 Initial Release+

March 19, 2019
March 19, 2019

Reference number:

197107