From 41ca2a64a962a0491e579ea0247e395bf785c577 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 14 Nov 2017 09:35:48 -0500 Subject: [PATCH] fix tag removal --- .../NotificationHubPushRegistrationService.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Core/Services/Implementations/NotificationHubPushRegistrationService.cs b/src/Core/Services/Implementations/NotificationHubPushRegistrationService.cs index e86c321b6..9a9c61b96 100644 --- a/src/Core/Services/Implementations/NotificationHubPushRegistrationService.cs +++ b/src/Core/Services/Implementations/NotificationHubPushRegistrationService.cs @@ -117,7 +117,7 @@ namespace Bit.Core.Services } catch(Exception e) { - if(!e.Message.Contains("(400) Bad Request")) + if(e.InnerException == null || !e.InnerException.Message.Contains("(404) Not Found")) { throw e; } @@ -145,10 +145,18 @@ namespace Bit.Core.Services var operation = new PartialUpdateOperation { Operation = op, - Path = "/tags", - Value = tag + Path = "/tags" }; + if(op == UpdateOperationType.Add) + { + operation.Value = tag; + } + else if(op == UpdateOperationType.Remove) + { + operation.Path += $"/{tag}"; + } + foreach(var id in deviceIds) { try @@ -157,7 +165,7 @@ namespace Bit.Core.Services } catch(Exception e) { - if(!e.Message.Contains("(400) Bad Request")) + if(e.InnerException == null || !e.InnerException.Message.Contains("(404) Not Found")) { throw e; }