From f921b805cd2e465ec5e939abca7b577c8f43bebc Mon Sep 17 00:00:00 2001 From: honurbu Date: Fri, 2 Feb 2024 17:31:27 +0300 Subject: [PATCH] Url controls added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: SALİH ÖZKARA <58659931+salihozkara@users.noreply.github.com> --- .../Pages/Documents/Project/Index.cshtml.cs | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index 0ffa883d8d..141fa337c4 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -117,18 +117,25 @@ namespace Volo.Docs.Pages.Documents.Project { return Redirect(decodedUrl); } - try - { - return await SetPageAsync(); - } - catch (DocumentNotFoundException exception) - { - Logger.LogWarning(exception.Message); + var documentNameFallback = DocumentName ?? ""; - DocumentFound = false; - Response.StatusCode = 404; - return Page(); + var documentNames = new[] { DocumentName, documentNameFallback.EnsureEndsWith('/') + "Index", documentNameFallback.EnsureEndsWith('/') + "index" }; + + foreach (var documentName in documentNames) + { + DocumentName = documentName; + try + { + return await SetPageAsync(); + } + catch (DocumentNotFoundException exception) + { + Logger.LogWarning(exception.Message); + } } + DocumentFound = false; + Response.StatusCode = 404; + return Page(); } private async Task SetPageAsync()