diff --git a/Duplicati/Library/RestAPI/Database/Backup.cs b/Duplicati/Library/RestAPI/Database/Backup.cs index 0eb658ed6..ed2c11217 100644 --- a/Duplicati/Library/RestAPI/Database/Backup.cs +++ b/Duplicati/Library/RestAPI/Database/Backup.cs @@ -175,6 +175,24 @@ namespace Duplicati.Server.Database } } } + + public Backup Clone() + { + return new Backup() + { + ID = this.ID, + ExternalID = this.ExternalID, + Name = this.Name, + Description = this.Description, + Tags = (string[])this.Tags?.Clone() ?? [], + TargetURL = this.TargetURL, + DBPath = this.DBPath, + Sources = (string[])this.Sources?.Clone() ?? [], + Settings = this.Settings?.Select(s => new Setting { Name = s.Name, Value = s.Value, Filter = s.Filter }).ToArray() ?? [], + Filters = this.Filters?.Select(f => new Filter { Order = f.Order, Include = f.Include, Expression = f.Expression }).ToArray() ?? [], + Metadata = new Dictionary(this.Metadata) + }; + } } } diff --git a/Duplicati/Library/RestAPI/Database/Connection.cs b/Duplicati/Library/RestAPI/Database/Connection.cs index dee9642fa..abb78a5cc 100644 --- a/Duplicati/Library/RestAPI/Database/Connection.cs +++ b/Duplicati/Library/RestAPI/Database/Connection.cs @@ -226,7 +226,7 @@ namespace Duplicati.Server.Database lock (m_lock) { m_temporaryBackups.TryGetValue(id, out var b); - return b; + return b?.Clone(); } }