Misc cleanup
This commit is contained in:
@@ -22,8 +22,7 @@ namespace Umbraco.Web.Routing
|
||||
return null;
|
||||
}
|
||||
|
||||
var propType = content.ContentType.GetPropertyType(propertyAlias);
|
||||
|
||||
var propType = prop.PropertyType;
|
||||
string path = null;
|
||||
|
||||
switch (propType.EditorAlias)
|
||||
@@ -33,18 +32,12 @@ namespace Umbraco.Web.Routing
|
||||
break;
|
||||
case Constants.PropertyEditors.Aliases.ImageCropper:
|
||||
//get the url from the json format
|
||||
|
||||
var stronglyTyped = value as ImageCropperValue;
|
||||
if (stronglyTyped != null)
|
||||
{
|
||||
path = stronglyTyped.Src;
|
||||
break;
|
||||
}
|
||||
path = value.ToString();
|
||||
path = value is ImageCropperValue stronglyTyped ? stronglyTyped.Src : value.ToString();
|
||||
break;
|
||||
}
|
||||
|
||||
return path == null ? null : UrlInfo.Url(AssembleUrl(path, current, mode).ToString(), culture);
|
||||
var url = AssembleUrl(path, current, mode);
|
||||
return url == null ? null : UrlInfo.Url(url.ToString(), culture);
|
||||
}
|
||||
|
||||
private Uri AssembleUrl(string path, Uri current, UrlProviderMode mode)
|
||||
@@ -70,7 +63,7 @@ namespace Umbraco.Web.Routing
|
||||
throw new ArgumentOutOfRangeException(nameof(mode));
|
||||
}
|
||||
|
||||
return uri.Rewrite(UriUtility.ToAbsolute(uri.GetSafeAbsolutePath()));
|
||||
return UriUtility.MediaUriFromUmbraco(uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Umbraco.Web.Routing
|
||||
public interface IMediaUrlProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the nice url of a media item.
|
||||
/// Gets the url of a media item.
|
||||
/// </summary>
|
||||
/// <param name="umbracoContext">The Umbraco context.</param>
|
||||
/// <param name="content">The published content.</param>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Umbraco.Web.Routing
|
||||
public interface IUrlProvider
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="umbracoContext">The Umbraco context.</param>
|
||||
/// <param name="content">The published content.</param>
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
public MediaUrlProviderCollection(IEnumerable<IMediaUrlProvider> items)
|
||||
: base(items)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Umbraco.Web.Routing
|
||||
=> GetUrl(content, Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
@@ -115,7 +115,7 @@ namespace Umbraco.Web.Routing
|
||||
=> GetUrl(GetDocument(id), Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="id">The published content identifier.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
@@ -130,7 +130,7 @@ namespace Umbraco.Web.Routing
|
||||
=> GetUrl(GetDocument(id), GetMode(absolute), culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="id">The published content identifier.</param>
|
||||
/// <param name="mode">The url mode.</param>
|
||||
@@ -151,7 +151,7 @@ namespace Umbraco.Web.Routing
|
||||
=> GetUrl(GetDocument(id), Mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="id">The published content identifier.</param>
|
||||
/// <param name="absolute">A value indicating whether the url should be absolute in any case.</param>
|
||||
@@ -166,7 +166,7 @@ namespace Umbraco.Web.Routing
|
||||
=> GetUrl(GetDocument(id), GetMode(absolute), culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="id">The published content identifier.</param>
|
||||
/// <param name="mode">The url mode.</param>
|
||||
@@ -177,7 +177,7 @@ namespace Umbraco.Web.Routing
|
||||
=> GetUrl(GetDocument(id), mode, culture, current);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the nice url of a published content.
|
||||
/// Gets the url of a published content.
|
||||
/// </summary>
|
||||
/// <param name="content">The published content.</param>
|
||||
/// <param name="mode">The url mode.</param>
|
||||
|
||||
@@ -72,6 +72,15 @@ namespace Umbraco.Web
|
||||
return uri.Rewrite(path);
|
||||
}
|
||||
|
||||
// maps a media umbraco uri to a public uri
|
||||
// ie with virtual directory - that is all for media
|
||||
public static Uri MediaUriFromUmbraco(Uri uri)
|
||||
{
|
||||
var path = uri.GetSafeAbsolutePath();
|
||||
path = ToAbsolute(path);
|
||||
return uri.Rewrite(path);
|
||||
}
|
||||
|
||||
// maps a public uri to an internal umbraco uri
|
||||
// ie no virtual directory, no .aspx, lowercase...
|
||||
public static Uri UriToUmbraco(Uri uri)
|
||||
|
||||
Reference in New Issue
Block a user