From 4cd56225847e58a1734915715d71ceb96dca6724 Mon Sep 17 00:00:00 2001 From: atir_naveed_geeksltd Date: Mon, 27 Jan 2025 13:55:46 +0000 Subject: [PATCH] Update changes --- Olive.Blob.Azure/AzureBlobStorageProvider.cs | 18 ++++++++++++++++++ Olive.Blob.Azure/Olive.Blob.Azure.csproj | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Olive.Blob.Azure/AzureBlobStorageProvider.cs b/Olive.Blob.Azure/AzureBlobStorageProvider.cs index 02cef585..3c5affaf 100644 --- a/Olive.Blob.Azure/AzureBlobStorageProvider.cs +++ b/Olive.Blob.Azure/AzureBlobStorageProvider.cs @@ -161,6 +161,24 @@ public async Task DeleteAsync(Blob document) } } + public async Task DeleteAsync(Blob document, string key) + { + if (document.IsEmpty()) return; + + var blobContainer = await GetBlobContainer(); + key = key.Or(document.GetKey()); + + try + { + await blobContainer.DeleteBlobAsync(document.GetKey()); + } + catch (Exception ex) + { + Log.Error(ex, $"Failed to delete document with {key} key on Azure"); + throw; + } + } + public byte[] ToByte(Stream input) { using (MemoryStream ms = new MemoryStream()) diff --git a/Olive.Blob.Azure/Olive.Blob.Azure.csproj b/Olive.Blob.Azure/Olive.Blob.Azure.csproj index 1fa335c2..bf3a17d1 100644 --- a/Olive.Blob.Azure/Olive.Blob.Azure.csproj +++ b/Olive.Blob.Azure/Olive.Blob.Azure.csproj @@ -1,7 +1,7 @@  netcoreapp3.1 - 3.1.118 + 3.1.119