Skip to content

Commit cf2f0e0

Browse files
committed
new test,
quick fix azure list globbing at root
1 parent 690bc1c commit cf2f0e0

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/GeekLearning.Storage.Azure/Internal/AzureListDirectoryWrapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ public AzureListDirectoryWrapper(FileSystemInfoBase childrens)
2222

2323
public AzureListDirectoryWrapper(string path, Dictionary<string, AzureFileReference> files)
2424
{
25-
this.path = path;
25+
this.path = path ?? "";
2626
this.files = files;
27-
this.fullName = path;
28-
var lastSlash = path.LastIndexOf('/');
27+
this.fullName = this.path;
28+
var lastSlash = this.path.LastIndexOf('/');
2929
if (lastSlash >= 0)
3030
{
3131
this.name = path.Substring(lastSlash + 1);

tests/GeekLearning.Integration.Test/ListTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,24 @@ public async Task FileNameGlobbing(string storeName)
132132
Assert.Empty(missingFiles);
133133
Assert.Empty(unexpectedFiles);
134134
}
135+
136+
[Theory(DisplayName = nameof(FileNameGlobbingAtRoot)), InlineData("azure"), InlineData("filesystem")]
137+
public async Task FileNameGlobbingAtRoot(string storeName)
138+
{
139+
var storageFactory = this.storeFixture.Services.GetRequiredService<IStorageFactory>();
140+
141+
var store = storageFactory.GetStore(storeName);
142+
143+
var expected = new string[] { "template.hbs" };
144+
145+
var results = await store.ListAsync("", "template.*");
146+
147+
var missingFiles = expected.Except(results.Select(f => f.Path)).ToArray();
148+
149+
var unexpectedFiles = results.Select(f => f.Path).Except(expected).ToArray();
150+
151+
Assert.Empty(missingFiles);
152+
Assert.Empty(unexpectedFiles);
153+
}
135154
}
136155
}

0 commit comments

Comments
 (0)