Merge pull request #6595 from duplicati/feature/protect-temporary-backups

Temporary backups return deep copies
This commit is contained in:
Kenneth Skovhede
2025-11-04 10:51:30 +01:00
committed by GitHub
2 changed files with 19 additions and 1 deletions
@@ -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<string, string>(this.Metadata)
};
}
}
}
@@ -226,7 +226,7 @@ namespace Duplicati.Server.Database
lock (m_lock)
{
m_temporaryBackups.TryGetValue(id, out var b);
return b;
return b?.Clone();
}
}