fix: Fixes string interpolation in value string builder (#1339)

This commit is contained in:
Kamron Batman 2023-02-13 23:09:50 -08:00 • committed by GitHub
parent b46544d752
commit f24c6a08dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 242 deletions

View file

@ -96,13 +96,22 @@ namespace Server.Compression
new FileInfo(destinationArchiveFileName).EnsureDirectory();
using var builder = ValueStringBuilder.Create();
var sb = ValueStringBuilder.Create();
var i = 0;
foreach (var path in paths)
{
builder.Append($"{(i++ > 0 ? " " : "")}\"{Path.GetRelativePath(relativeTo, path)}\"");
var relativePath = Path.GetRelativePath(relativeTo, path);
if (i++ > 0)
{
sb.Append($" \"{relativePath}\"");
}
else
{
sb.Append($"\"{relativePath}\"");
}
}
var pathsToCompress = builder.ToString();
var pathsToCompress = sb.ToString();
sb.Dispose();
var tarFlags = compressCommand == null ? "-acf" : "-cf";
var useExternalCompression = compressCommand != null ? $"--use-compress-program \"{compressCommand}\" " : "";