1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

[Bug] Fix cipher clone yielding incorrect RevisionDate (#1031)

* Fix cipher clone yielding incorrect RevisionDate

* PR fixes

Co-authored-by: Matt Gibson <mdgibson@Matts-MBP.lan>
This commit is contained in:
Matt Gibson
2020-12-07 19:35:34 -06:00
committed by GitHub
parent 8d9b1ff214
commit 7eaf7ab770
5 changed files with 50 additions and 4 deletions

View File

@ -359,6 +359,11 @@ namespace Bit.Core.Utilities
return readable.ToString("0.## ") + suffix;
}
/// <summary>
/// Creates a clone of the given object through serializing to json and deserializing.
/// This method is subject to the limitations of Newstonsoft. For example, properties with
/// inaccessible setters will not be set.
/// </summary>
public static T CloneObject<T>(T obj)
{
return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(obj));