From 50659787ee67ec04324efa2a70e4ef7bbdcd66c6 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 17 May 2018 15:26:06 +0200 Subject: [PATCH] fixes published content Url for invariant --- src/Umbraco.Web/Routing/UrlProvider.cs | 6 ++--- src/Umbraco.Web/UrlHelperRenderExtensions.cs | 24 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs index 5ef245d73b..6fa818f392 100644 --- a/src/Umbraco.Web/Routing/UrlProvider.cs +++ b/src/Umbraco.Web/Routing/UrlProvider.cs @@ -190,10 +190,8 @@ namespace Umbraco.Web.Routing // this the ONLY place where we deal with default culture - IUrlProvider always receive a culture if (culture == null) - { - culture = content.ContentType.Variations.Has(ContentVariation.CultureNeutral) // fixme CultureSegment - ? _variationContextAccessor.VariationContext.Culture - : null; + { + culture = _variationContextAccessor.VariationContext.Culture; } if (current == null) diff --git a/src/Umbraco.Web/UrlHelperRenderExtensions.cs b/src/Umbraco.Web/UrlHelperRenderExtensions.cs index 100881241f..bc2e2cef8f 100644 --- a/src/Umbraco.Web/UrlHelperRenderExtensions.cs +++ b/src/Umbraco.Web/UrlHelperRenderExtensions.cs @@ -6,6 +6,7 @@ using Umbraco.Core; using Umbraco.Core.Exceptions; using Umbraco.Core.Models; using Umbraco.Core.Models.PublishedContent; +using Umbraco.Core.PropertyEditors.ValueConverters; using Umbraco.Web.Composing; using Umbraco.Web.Models; using Umbraco.Web.Mvc; @@ -227,6 +228,29 @@ namespace Umbraco.Web imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode, upScale); return htmlEncode ? new HtmlString(HttpUtility.HtmlEncode(url)) : new HtmlString(url); + } + + public static IHtmlString GetCropUrl(this UrlHelper urlHelper, + ImageCropperValue imageCropperValue, + int? width = null, + int? height = null, + string cropAlias = null, + int? quality = null, + ImageCropMode? imageCropMode = null, + ImageCropAnchor? imageCropAnchor = null, + bool preferFocalPoint = false, + bool useCropDimensions = false, + string cacheBusterValue = null, + string furtherOptions = null, + ImageCropRatioMode? ratioMode = null, + bool upScale = true, + bool htmlEncode = true) + { + var imageUrl = imageCropperValue.Src; + var url = imageUrl.GetCropUrl(imageCropperValue, width, height, cropAlias, quality, imageCropMode, + imageCropAnchor, preferFocalPoint, useCropDimensions, cacheBusterValue, furtherOptions, ratioMode, + upScale); + return htmlEncode ? new HtmlString(HttpUtility.HtmlEncode(url)) : new HtmlString(url); } #endregion