mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 11:17:28 +08:00
Fixes #6639 : Azure Media Storage don't recognizes its own URLs
Compares url to default endpoint hostname and public hostname.
This commit is contained in:
@@ -4,6 +4,7 @@ using Orchard.Azure.Services.Environment.Configuration;
|
|||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
using Orchard.FileSystems.Media;
|
using Orchard.FileSystems.Media;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Orchard.Azure.Services.FileSystems.Media {
|
namespace Orchard.Azure.Services.FileSystems.Media {
|
||||||
|
|
||||||
@@ -64,8 +65,10 @@ namespace Orchard.Azure.Services.FileSystems.Media {
|
|||||||
/// <returns>The corresponding local path.</returns>
|
/// <returns>The corresponding local path.</returns>
|
||||||
public string GetStoragePath(string url) {
|
public string GetStoragePath(string url) {
|
||||||
EnsureInitialized();
|
EnsureInitialized();
|
||||||
if (url.StartsWith(_absoluteRoot)) {
|
var rootUri = new Uri(_absoluteRoot);
|
||||||
return HttpUtility.UrlDecode(url.Substring(Combine(_absoluteRoot, "/").Length));
|
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;
|
return null;
|
||||||
|
Reference in New Issue
Block a user