update aws s3 dependency

This commit is contained in:
Mathias Beaulieu-Duncan 2024-11-10 23:48:12 -05:00
parent c0b8b92c21
commit 247b0d356f
Signed by: mathias
GPG Key ID: 1C16CF05BAF9162D
2 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.3.110.10" /> <PackageReference Include="AWSSDK.S3" Version="3.7.405.11" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -51,13 +51,15 @@ public partial class S3StorageProvider(string endpoint, string bucketName, strin
public async Task DeleteDirectoryAsync(string path, bool force = false, CancellationToken cancellationToken = default) public async Task DeleteDirectoryAsync(string path, bool force = false, CancellationToken cancellationToken = default)
{ {
using var client = GetClient(); using var client = GetClient();
var files = await this.GetS3FilesAsync(prefix: path, delimiter: null, cancellationToken: cancellationToken); var files = await GetS3FilesAsync(prefix: path, delimiter: null, cancellationToken: cancellationToken);
var next = files.AsQueryable(); var next = files.AsQueryable();
while(next.Any()) while(next.Any())
{ {
var next1000 = next.Take(1000); var next1000 = next.Take(1000);
var keys = next1000.Select(s3o => new KeyVersion { Key = s3o.Key }).ToList(); var keys = next1000.Select(s3Object => new KeyVersion { Key = s3Object.Key })
.ToList();
await client.DeleteObjectsAsync(new DeleteObjectsRequest await client.DeleteObjectsAsync(new DeleteObjectsRequest
{ {
BucketName = bucketName, BucketName = bucketName,