Skip to content

Commit 3cc8a86

Browse files
committed
fix fallback to embedded resource and ensure we refresh fileinfo since with mockdata we need to
1 parent 340c231 commit 3cc8a86

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Elastic.Documentation.Configuration/ConfigurationFileProvider.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ private StreamReader GetLocalOrEmbedded(EmbeddedResource resource)
5454

5555
private static StreamReader GetEmbeddedStream(EmbeddedResource resource)
5656
{
57-
var stream = resource.GetStream();
58-
var reader = new StreamReader(stream, leaveOpen: false);
57+
var name = resource.GetResourceName().Replace(".......config.", ".");
58+
var resourceStream = typeof(EmbeddedResource).Assembly.GetManifestResourceStream(name)!;
59+
var reader = new StreamReader(resourceStream, leaveOpen: false);
5960
return reader;
6061
}
6162

src/Elastic.Documentation/Extensions/IFileInfoExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public static class IFileInfoExtensions
1010
{
1111
public static string ReadToEnd(this IFileInfo fileInfo)
1212
{
13+
fileInfo.Refresh();
1314
if (!fileInfo.Exists)
1415
return string.Empty;
1516

0 commit comments

Comments
 (0)