Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip processing of media root path by MediaFileStoreResolverMiddleware #16760

Merged
merged 6 commits into from
Sep 20, 2024
Merged
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
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)))
gvkries marked this conversation as resolved.
Show resolved Hide resolved
{
_logger.LogDebug("Request path {Path} does not match the assets request path {RequestPath}", subPath, _assetsRequestPath);
await _next(context);

return;
hishamco marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down