1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-26 12:55:17 +01:00

fix tag removal

This commit is contained in:
Kyle Spearrin 2017-11-14 09:35:48 -05:00
parent 49f4a773dc
commit 41ca2a64a9

View File

@ -117,7 +117,7 @@ namespace Bit.Core.Services
} }
catch(Exception e) catch(Exception e)
{ {
if(!e.Message.Contains("(400) Bad Request")) if(e.InnerException == null || !e.InnerException.Message.Contains("(404) Not Found"))
{ {
throw e; throw e;
} }
@ -145,10 +145,18 @@ namespace Bit.Core.Services
var operation = new PartialUpdateOperation var operation = new PartialUpdateOperation
{ {
Operation = op, Operation = op,
Path = "/tags", Path = "/tags"
Value = tag
}; };
if(op == UpdateOperationType.Add)
{
operation.Value = tag;
}
else if(op == UpdateOperationType.Remove)
{
operation.Path += $"/{tag}";
}
foreach(var id in deviceIds) foreach(var id in deviceIds)
{ {
try try
@ -157,7 +165,7 @@ namespace Bit.Core.Services
} }
catch(Exception e) catch(Exception e)
{ {
if(!e.Message.Contains("(400) Bad Request")) if(e.InnerException == null || !e.InnerException.Message.Contains("(404) Not Found"))
{ {
throw e; throw e;
} }