mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
#18630: Fixing image publication on Azure
Work Item: 18630 --HG-- branch : 1.x
This commit is contained in:
@@ -25,6 +25,10 @@ namespace Orchard.Mvc.Extensions {
|
||||
}
|
||||
|
||||
public static string MakeAbsolute(this UrlHelper urlHelper, string url, string baseUrl = null) {
|
||||
if(url.StartsWith("http", StringComparison.OrdinalIgnoreCase)) {
|
||||
return url;
|
||||
}
|
||||
|
||||
if(String.IsNullOrEmpty(baseUrl)) {
|
||||
baseUrl = urlHelper.RequestContext.HttpContext.Request.ToApplicationRootUrlString();
|
||||
}
|
||||
@@ -34,14 +38,14 @@ namespace Orchard.Mvc.Extensions {
|
||||
}
|
||||
|
||||
// remove any application path from the base url
|
||||
var applicationPath = urlHelper.RequestContext.HttpContext.Request.ApplicationPath;
|
||||
var applicationPath = urlHelper.RequestContext.HttpContext.Request.ApplicationPath ?? String.Empty;
|
||||
|
||||
// orchardlocal/foo/bar => /orchardlocal/foo/bar
|
||||
if(!url.StartsWith("/")) {
|
||||
url = "/" + url;
|
||||
}
|
||||
// /orchardlocal/foo/bar => foo/bar
|
||||
if (url.StartsWith(applicationPath)) {
|
||||
if (url.StartsWith(applicationPath, StringComparison.OrdinalIgnoreCase)) {
|
||||
url = url.Substring(applicationPath.Length);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user