avoid null exception in AzureBlobStorageProvider.GetStoragePath, fixes #4402

This commit is contained in:
Kegan Maher
2015-04-24 15:06:01 -07:00
committed by Sebastien Ros
parent 255547288b
commit dbe89d0a82
2 changed files with 2 additions and 1 deletions

View File

@@ -63,7 +63,7 @@ namespace Orchard.Azure.Services.FileSystems {
_publicHostName = publicHostName; _publicHostName = publicHostName;
} }
private void EnsureInitialized() { protected void EnsureInitialized() {
if (_storageAccount != null) { if (_storageAccount != null) {
return; return;
} }

View File

@@ -60,6 +60,7 @@ namespace Orchard.Azure.Services.FileSystems.Media {
/// <param name="url">The public URL of the media.</param> /// <param name="url">The public URL of the media.</param>
/// <returns>The corresponding local path.</returns> /// <returns>The corresponding local path.</returns>
public string GetStoragePath(string url) { public string GetStoragePath(string url) {
EnsureInitialized();
if (url.StartsWith(_absoluteRoot)) { if (url.StartsWith(_absoluteRoot)) {
return HttpUtility.UrlDecode(url.Substring(Combine(_absoluteRoot, "/").Length)); return HttpUtility.UrlDecode(url.Substring(Combine(_absoluteRoot, "/").Length));
} }