8539: Allow alias in image cropper (#9266)

Co-authored-by: Owain Williams <owaingdwilliams@gmail.com>
This commit is contained in:
Benjamin Carleski
2021-03-18 15:04:03 -07:00
committed by GitHub
parent 45de0a101e
commit 7f1d5fe7cc
3 changed files with 50 additions and 4 deletions

View File

@@ -1,5 +1,9 @@
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Http;
using System.Web.Http.Controllers;
using Umbraco.Core;
@@ -17,6 +21,8 @@ namespace Umbraco.Web.Editors.Binders
/// </summary>
internal static class ContentModelBinderHelper
{
private const char _escapeChar = '\\';
public static TModelSave BindModelFromMultipartRequest<TModelSave>(HttpActionContext actionContext, ModelBindingContext bindingContext)
where TModelSave : IHaveUploadedFiles
{
@@ -30,6 +36,7 @@ namespace Umbraco.Web.Editors.Binders
//The name that has been assigned in JS has 2 or more parts. The second part indicates the property id
// for which the file belongs, the remaining parts are just metadata that can be used by the property editor.
var parts = file.Headers.ContentDisposition.Name.Trim(Constants.CharArrays.DoubleQuote).Split(Constants.CharArrays.Underscore);
if (parts.Length < 2)
{
var response = actionContext.Request.CreateResponse(HttpStatusCode.BadRequest);