Skip to content

Commit e7c7c87

Browse files
committed
eat urlpath prefix when generating file names
1 parent 665d9da commit e7c7c87

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Elastic.ApiExplorer/Landing/LandingNavigationItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public class EndpointNavigationItem(ApiEndpoint endpoint, IRootNavigationItem<IA
146146
public int Depth => 0;
147147

148148
/// <inheritdoc />
149-
public string Id { get; } = ShortId.Create(endpoint.Operations.First().ApiName + endpoint.Operations.First().Route);
149+
public string Id { get; } = ShortId.Create(nameof(EndpointNavigationItem), endpoint.Operations.First().ApiName, endpoint.Operations.First().Route);
150150

151151
/// <inheritdoc />
152152
public ApiEndpoint Index { get; } = endpoint;

src/Elastic.ApiExplorer/OpenApiGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information
44

55
using System.IO.Abstractions;
6+
using System.Text.RegularExpressions;
67
using Elastic.ApiExplorer.Landing;
78
using Elastic.ApiExplorer.Operations;
89
using Elastic.Documentation;
@@ -300,7 +301,7 @@ private async Task<IFileInfo> Render<T>(INavigationItem current, T page, ApiRend
300301
IFileInfo OutputFile(INavigationItem currentNavigation)
301302
{
302303
const string indexHtml = "index.html";
303-
var fileName = currentNavigation.Url + "/" + indexHtml;
304+
var fileName = Regex.Replace(currentNavigation.Url + "/" + indexHtml, $"^{context.UrlPathPrefix}", string.Empty);
304305
var fileInfo = _writeFileSystem.FileInfo.New(Path.Combine(context.DocumentationOutputDirectory.FullName, fileName.Trim('/')));
305306
return fileInfo;
306307
}

0 commit comments

Comments
 (0)