mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
trim Uri proper from stored json on save
This commit is contained in:
parent
005b2a4fb6
commit
deb1ead4ea
3 changed files with 8 additions and 5 deletions
|
@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Bit.App.Enums;
|
using Bit.App.Enums;
|
||||||
using Bit.App.Models.Api;
|
using Bit.App.Models.Api;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace Bit.App.Models.Data
|
namespace Bit.App.Models.Data
|
||||||
{
|
{
|
||||||
|
@ -31,8 +32,10 @@ namespace Bit.App.Models.Data
|
||||||
switch(cipher.Type)
|
switch(cipher.Type)
|
||||||
{
|
{
|
||||||
case CipherType.Login:
|
case CipherType.Login:
|
||||||
var loginData = new LoginDataModel(cipher);
|
var loginObj = JObject.FromObject(new LoginDataModel(cipher),
|
||||||
Login = JsonConvert.SerializeObject(loginData);
|
new JsonSerializer { NullValueHandling = NullValueHandling.Ignore });
|
||||||
|
loginObj[nameof(LoginDataModel.Uri)]?.Parent?.Remove();
|
||||||
|
Login = loginObj.ToString(Formatting.None);
|
||||||
break;
|
break;
|
||||||
case CipherType.SecureNote:
|
case CipherType.SecureNote:
|
||||||
var noteData = new SecureNoteDataModel(cipher);
|
var noteData = new SecureNoteDataModel(cipher);
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Bit.App.Models.Data
|
||||||
{
|
{
|
||||||
Name = cipher.Name;
|
Name = cipher.Name;
|
||||||
Notes = cipher.Notes;
|
Notes = cipher.Notes;
|
||||||
Fields = cipher.Fields.Select(f => new FieldDataModel(f));
|
Fields = cipher.Fields?.Select(f => new FieldDataModel(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace Bit.App.Models
|
||||||
public Identity(CipherData data)
|
public Identity(CipherData data)
|
||||||
{
|
{
|
||||||
IdentityDataModel deserializedData;
|
IdentityDataModel deserializedData;
|
||||||
if(data.Card != null)
|
if(data.Identity != null)
|
||||||
{
|
{
|
||||||
deserializedData = JsonConvert.DeserializeObject<IdentityDataModel>(data.Card);
|
deserializedData = JsonConvert.DeserializeObject<IdentityDataModel>(data.Identity);
|
||||||
}
|
}
|
||||||
else if(data.Data != null)
|
else if(data.Data != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue