#20384: Reconstructing Uri using UriBuilder when there's an available public host name for Azure storage (Orchard.Azure)

This commit is contained in:
Lombiq
2014-03-08 00:09:49 +01:00
committed by Benedek Farkas
parent bf07c5e2d4
commit 584981efe3

View File

@@ -289,8 +289,9 @@ namespace Orchard.Azure.Services.FileSystems {
public string GetPublicUrl(string path) {
path = ConvertToRelativeUriPath(path);
var uri = Container.GetBlockBlobReference(String.Concat(_root, path)).Uri;
return string.IsNullOrEmpty(_publicHostName) ? uri.ToString() : uri.ToString().Replace(uri.Host, _publicHostName);
var uri = new UriBuilder(Container.GetBlockBlobReference(String.Concat(_root, path)).Uri);
if (!string.IsNullOrEmpty(_publicHostName)) uri.Host = _publicHostName;
return uri.ToString();
}
private class AzureBlobFileStorage : IStorageFile {