diff --git a/src/ApiService/ApiService/onefuzzlib/Containers.cs b/src/ApiService/ApiService/onefuzzlib/Containers.cs index c77597986f..83840c99f1 100644 --- a/src/ApiService/ApiService/onefuzzlib/Containers.cs +++ b/src/ApiService/ApiService/onefuzzlib/Containers.cs @@ -212,17 +212,17 @@ public async Async.Task BlobExists(Container container, string name, Stora } public async Task>> GetContainers(StorageType corpus) { - var accounts = _storage.GetAccounts(corpus); - IEnumerable>>> data = - await Async.Task.WhenAll(accounts.Select(async acc => { - var service = await _storage.GetBlobServiceClientForAccount(acc); - return await service - .GetBlobContainersAsync(BlobContainerTraits.Metadata) - .Select(container => KeyValuePair.Create(Container.Parse(container.Name), container.Properties.Metadata)) - .ToListAsync(); - })); - - return new(data.SelectMany(x => x)); + var result = new Dictionary>(); + + // same container name can exist in multiple accounts; here the last one wins + foreach (var account in _storage.GetAccounts(corpus)) { + var service = await _storage.GetBlobServiceClientForAccount(account); + await foreach (var container in service.GetBlobContainersAsync(BlobContainerTraits.Metadata)) { + result[Container.Parse(container.Name)] = container.Properties.Metadata; + } + } + + return result; } public string AuthDownloadUrl(Container container, string filename) {