From aeda66d3c608e90dc636717fd0c2b13a467fa843 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 24 Jun 2021 10:08:06 +0200 Subject: [PATCH] Fixes #10402 - GetCropUrl Url extension has duplicate signatures and results in error This is a breaking change for people using `GetCropUrl` to get local crops from the media picker v3. In order to disambiguate the extension method an make it a bit clearer what it does, I propose the method name change, after which there is no need to have the first argument being the local crops, but it can be the whole MediaWithCrops object, since the method name already makes clear you're not trying to get the global crops. --- src/Umbraco.Web/UrlHelperRenderExtensions.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/UrlHelperRenderExtensions.cs b/src/Umbraco.Web/UrlHelperRenderExtensions.cs index 592c88945bae..92d7e6309506 100644 --- a/src/Umbraco.Web/UrlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/UrlHelperRenderExtensions.cs @@ -4,6 +4,7 @@ using System.Web; using System.Web.Mvc; using Umbraco.Core; +using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; using Umbraco.Core.PropertyEditors.ValueConverters; using Umbraco.Web.Composing; @@ -262,8 +263,8 @@ public static IHtmlString GetCropUrl(this UrlHelper urlHelper, return htmlEncode ? new HtmlString(HttpUtility.HtmlEncode(url)) : new HtmlString(url); } - public static IHtmlString GetCropUrl(this UrlHelper urlHelper, - ImageCropperValue imageCropperValue, + public static IHtmlString GetLocalCropUrl(this UrlHelper urlHelper, + MediaWithCrops mediaWithCrops, string cropAlias, int? width = null, int? height = null, @@ -278,6 +279,7 @@ public static IHtmlString GetCropUrl(this UrlHelper urlHelper, bool upScale = true, bool htmlEncode = true) { + var imageCropperValue = mediaWithCrops.LocalCrops; if (imageCropperValue == null) return EmptyHtmlString; var imageUrl = imageCropperValue.Src;