From 6d581c57fe7b9d4d9700af4d8b00c31af8292ce5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 19 Mar 2019 21:41:24 -0400 Subject: [PATCH] delete with etag --- .../TableStorage/InstallationDeviceRepository.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Core/Repositories/TableStorage/InstallationDeviceRepository.cs b/src/Core/Repositories/TableStorage/InstallationDeviceRepository.cs index a260fc3be..355a27804 100644 --- a/src/Core/Repositories/TableStorage/InstallationDeviceRepository.cs +++ b/src/Core/Repositories/TableStorage/InstallationDeviceRepository.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Net; using System.Threading.Tasks; using Bit.Core.Models.Data; using Microsoft.WindowsAzure.Storage; @@ -73,7 +74,18 @@ namespace Bit.Core.Repositories.TableStorage public async Task DeleteAsync(InstallationDeviceEntity entity) { - await _table.ExecuteAsync(TableOperation.Delete(entity)); + try + { + entity.ETag = "*"; + await _table.ExecuteAsync(TableOperation.Delete(entity)); + } + catch(StorageException e) + { + if(e.RequestInformation.HttpStatusCode != (int)HttpStatusCode.NotFound) + { + throw e; + } + } } } }