fixes published content Url for invariant

This commit is contained in:
Shannon
2018-05-17 15:26:06 +02:00
parent 3da120ce33
commit 50659787ee
2 changed files with 26 additions and 4 deletions

View File

@@ -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)

View File

@@ -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