Skip to content

Commit

Permalink
增加条件过滤
Browse files Browse the repository at this point in the history
  • Loading branch information
239573049 committed Dec 20, 2024
1 parent 0186e24 commit 5df9cb3
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/NuGet.Next/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,20 @@

app.Use((async (context, next) =>
{
if (context.Request.Path == "/")
{
if (info.Exists)
{
await context.Response.SendFileAsync(Path.Combine("wwwroot", "index.html"));
}

return;
}

await next(context);

if (context.Response.StatusCode == 404)
if (context.Response.StatusCode == 404 && context.Request.Path.StartsWithSegments("/v3") &&
context.Request.Path.StartsWithSegments("/api"))
{
context.Response.StatusCode = 200;

Expand Down

0 comments on commit 5df9cb3

Please sign in to comment.