Merge branch 'refs/heads/dev-v7' into temp-U4-9337
This commit is contained in:
@@ -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<string, object>();
|
||||
var dictionary = new Dictionary<string, object>();
|
||||
//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<ContentController>("No property editor found for property " + p.Alias);
|
||||
LogHelper.Warn<ContentController>("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);
|
||||
|
||||
@@ -525,7 +525,8 @@ namespace Umbraco.Web.Editors
|
||||
foreach (var file in result.FileData)
|
||||
{
|
||||
var fileName = file.Headers.ContentDisposition.FileName.Trim(new[] { '\"' }).TrimEnd();
|
||||
var ext = fileName.Substring(fileName.LastIndexOf('.') + 1).ToLower();
|
||||
var safeFileName = fileName.ToSafeFileName();
|
||||
var ext = safeFileName.Substring(safeFileName.LastIndexOf('.') + 1).ToLower();
|
||||
|
||||
if (UmbracoConfig.For.UmbracoSettings().Content.DisallowedUploadFiles.Contains(ext) == false)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.InteropServices;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core;
|
||||
@@ -61,14 +60,7 @@ namespace Umbraco.Web.PropertyEditors
|
||||
public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue)
|
||||
{
|
||||
var json = editorValue.Value as JArray;
|
||||
return json == null
|
||||
? null
|
||||
: json.Select(x => x.Value<string>()).Where(x => x.IsNullOrWhiteSpace() == false)
|
||||
//First we will decode it as html because we know that if this is not a malicious post that the value is
|
||||
// already Html encoded by the tags JavaScript controller. Then we'll re-Html Encode it to ensure that in case this
|
||||
// is a malicious post (i.e. someone is submitting data manually by modifying the request).
|
||||
.Select(WebUtility.HtmlDecode)
|
||||
.Select(WebUtility.HtmlEncode);
|
||||
return json == null ? null : json.Select(x => x.Value<string>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -44,7 +44,17 @@ namespace Umbraco.Web.WebServices
|
||||
}
|
||||
catch (Exception ee)
|
||||
{
|
||||
LogHelper.Error<ScheduledPublishController>("Error executing scheduled task", ee);
|
||||
var errorMessage = "Error executing scheduled task";
|
||||
if (HttpContext != null && HttpContext.Request != null)
|
||||
{
|
||||
if (HttpContext.Request.Url != null)
|
||||
errorMessage = string.Format("{0} | Request to {1}", errorMessage, HttpContext.Request.Url);
|
||||
if (HttpContext.Request.UserHostAddress != null)
|
||||
errorMessage = string.Format("{0} | Coming from {1}", errorMessage, HttpContext.Request.UserHostAddress);
|
||||
if (HttpContext.Request.UrlReferrer != null)
|
||||
errorMessage = string.Format("{0} | Referrer {1}", errorMessage, HttpContext.Request.UrlReferrer);
|
||||
}
|
||||
LogHelper.Error<ScheduledPublishController>(errorMessage, ee);
|
||||
|
||||
Response.StatusCode = 400;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user