Fixed path conversion on Windows

This commit is contained in:
Kenneth Skovhede
2025-02-21 16:25:18 +01:00
parent de622b29d0
commit 4e73be1806
3 changed files with 10 additions and 8 deletions
@@ -236,7 +236,13 @@ namespace Duplicati.Library.Backend
/// <inheritdoc/>
public IAsyncEnumerable<IFileEntry> ListAsync(string path, CancellationToken cancellationToken)
=> m_s3Client.ListBucketAsync(m_bucket, path, false, cancellationToken);
{
var filterPath = GetFullKey(path);
if (!string.IsNullOrWhiteSpace(filterPath))
filterPath = Util.AppendDirSeparator(filterPath, "/");
return m_s3Client.ListBucketAsync(m_bucket, filterPath, true, cancellationToken);
}
/// <inheritdoc/>
+2 -6
View File
@@ -410,13 +410,9 @@ namespace Duplicati.Library.Backend
/// <inheritdoc/>
public IAsyncEnumerable<IFileEntry> ListAsync(string path, CancellationToken cancellationToken)
{
var prefix = m_prefix;
if (!string.IsNullOrWhiteSpace(prefix))
prefix = Util.AppendDirSeparator(prefix);
var filterPath = prefix + path;
var filterPath = GetFullKey(path);
if (!string.IsNullOrWhiteSpace(filterPath))
filterPath = Util.AppendDirSeparator(filterPath);
filterPath = Util.AppendDirSeparator(filterPath, "/");
return s3Client.ListBucketAsync(m_bucket, filterPath, m_recurseLists, cancellationToken);
}
@@ -96,7 +96,7 @@ public class BackendSourceFileEntry(BackendSourceProvider parent, string path, b
if (!isFolder)
throw new InvalidOperationException("Enumerate can only be called on folders");
return parent.WrappedBackend.ListAsync(path, cancellationToken)
return parent.WrappedBackend.ListAsync(NormalizePathTo(path, '/'), cancellationToken)
// Remove the current and parent folder entries
.Where(x => !string.IsNullOrWhiteSpace(x.Name) && x.Name != "." && x.Name != "..")
// Remove sub-folder entries