Fix exception when stored media url is already absolute
(cherry picked from commit 49b3351c72)
This commit is contained in:
committed by
Sebastiaan Janssen
parent
4612c03657
commit
ca56655d07
@@ -81,6 +81,19 @@ namespace Umbraco.Tests.Routing
|
||||
Assert.AreEqual(expected, resolvedUrl);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Media_Url_Returns_Absolute_Url_If_Stored_Url_Is_Absolute()
|
||||
{
|
||||
const string expected = "http://localhost/media/rfeiw584/test.jpg";
|
||||
|
||||
var umbracoContext = GetUmbracoContext("http://localhost", mediaUrlProviders: new[] { _mediaUrlProvider });
|
||||
var publishedContent = CreatePublishedContent(Constants.PropertyEditors.Aliases.UploadField, expected, null);
|
||||
|
||||
var resolvedUrl = umbracoContext.UrlProvider.GetMediaUrl(publishedContent, UrlMode.Relative);
|
||||
|
||||
Assert.AreEqual(expected, resolvedUrl);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Get_Media_Url_Returns_Empty_String_When_PropertyType_Is_Not_Supported()
|
||||
{
|
||||
|
||||
@@ -45,6 +45,10 @@ namespace Umbraco.Web.Routing
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return null;
|
||||
|
||||
// the stored path is absolute so we just return it as is
|
||||
if(Uri.IsWellFormedUriString(path, UriKind.Absolute))
|
||||
return new Uri(path);
|
||||
|
||||
Uri uri;
|
||||
|
||||
if (current == null)
|
||||
|
||||
Reference in New Issue
Block a user