From 7a105047e95e9803dec6eb00bc2ea6ce16206960 Mon Sep 17 00:00:00 2001 From: Shaun Walker Date: Mon, 23 Jan 2023 15:16:08 -0500 Subject: [PATCH] Fixed issue where TenantMiddleware was not rewriting the Url path for the new File Server when running on an Alias Path which resulted in a 404 when serving files --- Oqtane.Server/Infrastructure/Middleware/TenantMiddleware.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Oqtane.Server/Infrastructure/Middleware/TenantMiddleware.cs b/Oqtane.Server/Infrastructure/Middleware/TenantMiddleware.cs index 87dc89c8..c3386bdd 100644 --- a/Oqtane.Server/Infrastructure/Middleware/TenantMiddleware.cs +++ b/Oqtane.Server/Infrastructure/Middleware/TenantMiddleware.cs @@ -43,10 +43,10 @@ namespace Oqtane.Infrastructure }); context.Items.Add(Constants.HttpContextSiteSettingsKey, sitesettings); - // rewrite path by removing alias path prefix from api and pages requests (for consistent routing) + // rewrite path by removing alias path prefix from reserved route (api,pages,files) requests for consistent routes if (!string.IsNullOrEmpty(alias.Path)) { - if (path.StartsWith("/" + alias.Path) && (path.Contains("/api/") || path.Contains("/pages/"))) + if (path.StartsWith("/" + alias.Path) && (Constants.ReservedRoutes.Any(item => path.Contains("/" + item + "/")))) { context.Request.Path = path.Replace("/" + alias.Path, ""); }