1
0
mirror of https://github.com/bitwarden/server synced 2025-12-20 02:03:46 +00:00

backwards compat apis on Uri

This commit is contained in:
Kyle Spearrin
2018-03-01 09:29:49 -05:00
parent c8aabf0b40
commit 2b276e9986
6 changed files with 45 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ using System.Collections.Generic;
using System.Linq;
using Core.Models.Data;
using Bit.Core.Models.Data;
using Newtonsoft.Json.Linq;
namespace Bit.Core.Models.Api
{
@@ -60,8 +61,10 @@ namespace Bit.Core.Models.Api
switch(existingCipher.Type)
{
case CipherType.Login:
existingCipher.Data = JsonConvert.SerializeObject(new CipherLoginData(this),
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
var loginObj = JObject.FromObject(new CipherLoginData(this),
new JsonSerializer { NullValueHandling = NullValueHandling.Ignore });
loginObj[nameof(CipherLoginData.Uri)]?.Parent?.Remove();
existingCipher.Data = loginObj.ToString(Formatting.None);
break;
case CipherType.Card:
existingCipher.Data = JsonConvert.SerializeObject(new CipherCardData(this),