Skip to content

Commit

Permalink
Merge pull request #136 from LeonAquitaine/master
Browse files Browse the repository at this point in the history
case-sensitive path mapping.
  • Loading branch information
lbotinelly authored Nov 12, 2023
2 parents 003d790 + 58bcb7e commit 4eb1812
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Zen.Web/Middleware/Html5Router.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ public static void UseHtml5Routing(this IApplicationBuilder app)
{
app.Use(async (context, next) =>
{
var path = context.Request.Path.ToString().ToLower();
var path = context.Request.Path.ToString();
var lowerPath = path.ToLower();

if (path.StartsWith("/api") || path.EndsWith(".map")) { await next.Invoke(); return; }
if (lowerPath.StartsWith("/api") || lowerPath.EndsWith(".map")) { await next.Invoke(); return; }

var pathParts = path.Split('/', StringSplitOptions.RemoveEmptyEntries).ToList();
pathParts.Insert(0, "wwwroot");

var physicalPath = Path.Combine(pathParts.ToArray());

Zen.Base.Log.Add(context.Request.Path + context.Request.QueryString, Base.Module.Log.Message.EContentType.Debug);
Zen.Base.Log.Add(physicalPath, Base.Module.Log.Message.EContentType.Debug);
Base.Log.Add(context.Request.Path + context.Request.QueryString, Base.Module.Log.Message.EContentType.Debug);
Base.Log.Add(physicalPath, Base.Module.Log.Message.EContentType.Debug);

await LogRequest(context);

Expand Down

0 comments on commit 4eb1812

Please sign in to comment.