#20445: Changing CloudBlobContainerExtensions to use the new CloudBlockBlob.Exists() API instead of causing and swallowing exceptions.

Work Item: 20445
This commit is contained in:
Daniel Stolt
2014-01-24 16:21:23 +01:00
parent 2858fbf660
commit cddd90e2f3

View File

@@ -10,15 +10,7 @@ namespace Orchard.Azure.Services.FileSystems {
public static bool BlobExists(this CloudBlobContainer container, string path) {
if (String.IsNullOrEmpty(path) || path.Trim() == String.Empty)
throw new ArgumentException("Path can't be empty");
try {
var blob = container.GetBlockBlobReference(path);
blob.FetchAttributes();
return true;
}
catch (StorageException) {
return false;
}
return container.GetBlockBlobReference(path).Exists();
}
public static void EnsureBlobExists(this CloudBlobContainer container, string path) {