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) 

Solution

Be aware that the hotfixes were built for the specific Sitecore XP versions and must not be installed on other Sitecore XP versions or in combination with other hotfixes. In case any other hotfixes have already been installed on certain Sitecore XP instance, send a request for compatibility check to Sitecore Support.

Note that the ZIP file contents must be extracted to locate installation instructions and related files inside. The hotfixes must be installed on CM instance and then synced with other instances using standard development practices.