Skip to content

Commit 7b20ec8

Browse files
authored
Fix local file serving (#675)
1 parent e9ae9c6 commit 7b20ec8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/docs-builder/Http/DocumentationWebHost.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,17 @@ private static async Task<IResult> ServeDocumentationFile(ReloadableGeneratorSta
148148
{
149149
var generator = holder.Generator;
150150

151-
var s = Path.GetExtension(slug) == string.Empty ? slug + ".md" : slug;
151+
var s = Path.GetExtension(slug) == string.Empty ? Path.Combine(slug, "index.md") : slug;
152152
if (!generator.DocumentationSet.FlatMappedFiles.TryGetValue(s, out var documentationFile))
153153
{
154-
foreach (var extension in generator.Context.Configuration.EnabledExtensions)
154+
s = Path.GetExtension(slug) == string.Empty ? slug + ".md" : s.Replace("/index.md", ".md");
155+
if (!generator.DocumentationSet.FlatMappedFiles.TryGetValue(s, out documentationFile))
155156
{
156-
if (extension.TryGetDocumentationFileBySlug(generator.DocumentationSet, slug, out documentationFile))
157-
break;
157+
foreach (var extension in generator.Context.Configuration.EnabledExtensions)
158+
{
159+
if (extension.TryGetDocumentationFileBySlug(generator.DocumentationSet, slug, out documentationFile))
160+
break;
161+
}
158162
}
159163
}
160164

0 commit comments

Comments
 (0)