Skip to content

Commit

Permalink
Skip processing of media root path by MediaFileStoreResolverMiddleware (
Browse files Browse the repository at this point in the history
#16760)

Co-authored-by: Hisham Bin Ateya <[email protected]>
  • Loading branch information
AndreySurkov and hishamco authored Sep 20, 2024
1 parent 0eec6fa commit 4d8af4d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OrchardCore.FileStorage;
using OrchardCore.Routing;

namespace OrchardCore.Media.Services;
Expand Down Expand Up @@ -50,10 +51,10 @@ public async Task Invoke(HttpContext context)
}

var validatePath = context.Request.Path.StartsWithNormalizedSegments(_assetsRequestPath, StringComparison.OrdinalIgnoreCase, out var subPath);
if (!validatePath)
if (!validatePath || string.IsNullOrEmpty(_mediaFileStore.NormalizePath(subPath)))
{
_logger.LogDebug("Request path {Path} does not match the assets request path {RequestPath}", subPath, _assetsRequestPath);
await _next(context);

return;
}

Expand Down

0 comments on commit 4d8af4d

Please sign in to comment.