diff --git a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs index 618b57d31..b4e28edc3 100644 --- a/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs +++ b/src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/Media/AzureBlobStorageProvider.cs @@ -4,6 +4,7 @@ using Orchard.Azure.Services.Environment.Configuration; using Orchard.Environment.Configuration; using Orchard.Environment.Extensions; using Orchard.FileSystems.Media; +using System; namespace Orchard.Azure.Services.FileSystems.Media { @@ -64,8 +65,10 @@ namespace Orchard.Azure.Services.FileSystems.Media { /// The corresponding local path. public string GetStoragePath(string url) { EnsureInitialized(); - if (url.StartsWith(_absoluteRoot)) { - return HttpUtility.UrlDecode(url.Substring(Combine(_absoluteRoot, "/").Length)); + var rootUri = new Uri(_absoluteRoot); + var uri = new Uri(url); + if((uri.Host == rootUri.Host || (!string.IsNullOrWhiteSpace(_publicHostName) && uri.Host == _publicHostName)) && uri.AbsolutePath.StartsWith(rootUri.AbsolutePath)) { + return HttpUtility.UrlDecode(uri.PathAndQuery.Substring(Combine(rootUri.AbsolutePath, "/").Length)); } return null;