diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs index 495217cec2..0cddb6fcd5 100644 --- a/src/Umbraco.Web/Editors/ContentControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs @@ -88,35 +88,37 @@ namespace Umbraco.Web.Editors where TPersisted : IContentBase { //Map the property values - foreach (var p in contentItem.ContentDto.Properties) + foreach (var property in contentItem.ContentDto.Properties) { //get the dbo property - var dboProperty = contentItem.PersistedContent.Properties[p.Alias]; + var dboProperty = contentItem.PersistedContent.Properties[property.Alias]; //create the property data to send to the property editor - var d = new Dictionary(); + var dictionary = new Dictionary(); //add the files if any - var files = contentItem.UploadedFiles.Where(x => x.PropertyAlias == p.Alias).ToArray(); - if (files.Length > 0) - { - d.Add("files", files); - } + var files = contentItem.UploadedFiles.Where(x => x.PropertyAlias == property.Alias).ToArray(); + + foreach (var file in files) + file.FileName = file.FileName.ToSafeFileName(); + + if (files.Any()) + dictionary.Add("files", files); - var data = new ContentPropertyData(p.Value, p.PreValues, d); + var data = new ContentPropertyData(property.Value, property.PreValues, dictionary); //get the deserialized value from the property editor - if (p.PropertyEditor == null) + if (property.PropertyEditor == null) { - LogHelper.Warn("No property editor found for property " + p.Alias); + LogHelper.Warn("No property editor found for property " + property.Alias); } else { - var valueEditor = p.PropertyEditor.ValueEditor; + var valueEditor = property.PropertyEditor.ValueEditor; //don't persist any bound value if the editor is readonly if (valueEditor.IsReadOnly == false) { - var propVal = p.PropertyEditor.ValueEditor.ConvertEditorToDb(data, dboProperty.Value); - var supportTagsAttribute = TagExtractor.GetAttribute(p.PropertyEditor); + var propVal = property.PropertyEditor.ValueEditor.ConvertEditorToDb(data, dboProperty.Value); + var supportTagsAttribute = TagExtractor.GetAttribute(property.PropertyEditor); if (supportTagsAttribute != null) { TagExtractor.SetPropertyTags(dboProperty, data, propVal, supportTagsAttribute);