mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#20445: Changing CloudBlobContainerExtensions to use the new CloudBlockBlob.Exists() API instead of causing and swallowing exceptions.
Work Item: 20445
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user