Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Swashbuckle.AspNetCore.SwaggerUI/SwaggerUIMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ public async Task Invoke(HttpContext httpContext)
return;
}

var pattern = $"^/?{Regex.Escape(_options.RoutePrefix)}/{_options.SwaggerDocumentUrlsPath}/?$";
if (Regex.IsMatch(path, pattern, RegexOptions.IgnoreCase))
if (_options.ExposeSwaggerDocumentUrlsRoute)
{
await RespondWithDocumentUrls(httpContext);
return;
var pattern = $"^/?{Regex.Escape(_options.RoutePrefix)}/{_options.SwaggerDocumentUrlsPath}/?$";
if (Regex.IsMatch(path, pattern, RegexOptions.IgnoreCase))
{
await RespondWithDocumentUrls(httpContext);
return;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public static void UseResponseInterceptor(this SwaggerUIOptions options, string

/// <summary>
/// Function to enable the <see cref="SwaggerUIOptions.ExposeSwaggerDocumentUrlsRoute"/> option to expose the available
/// Swagger document urls to external parties.
/// Swagger document URLs to external parties.
/// </summary>
/// <param name="options"></param>
public static void EnableSwaggerDocumentUrlsEndpoint(this SwaggerUIOptions options)
Expand Down
Loading