Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS ListBlobsAsync trims first letter of object key when listing root of bucket #43

Open
DanielHarman opened this issue Feb 1, 2023 · 1 comment

Comments

@DanielHarman
Copy link

I'm currently trying to list files that are just contained in the root of a bucket in S3.

var listBlobsAsync = await _storageProvider.ListBlobsAsync("");

I expect to get a list of BlobDescriptors with the keys file1.txt, file2.txt and file3.txt for example but instead get ile1.txt, ile2.txt and ile3.txt

The problem occurs here because even when an empty string is provided, it will always trim at least one character.

Name = entry.Key.Remove(0, containerName.Length + 1),

@splitice
Copy link

That method can also crash I've found.

Unhandled exception: System.ArgumentOutOfRangeException: Index and count must refer to a location within the string. (Parameter 'count')
   at System.String.Remove(Int32 startIndex, Int32 count)
   at TwentyTwenty.Storage.Amazon.AmazonStorageProvider.ListBlobsAsync(String containerName)
   at X4BFlow.Main.DbLink.ObjConnector.ListBlobs(String containerName)+MoveNext() in /home/runner/work/X4BFlow.Net/X4BFlow.Net/X4BFlow.Main/DbLink/ObjConnector.cs:line 36

I havent yet worked out what the cause is though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants