Hotfix for HttpEndpointMiddleware

Fixes that subpath no longer matched any workflows
This commit is contained in:
Sipke Schoorstra 2021-07-15 15:33:31 +02:00
parent 3a6a4b5264
commit e3c3a32853
2 changed files with 10 additions and 3 deletions

View file

@ -11,7 +11,7 @@ environment:
sonarcloud_api_key:
secure: qaE9kOVkGGFM7ZMf3YeliZxDU9udTCy6W5xXHJ9T+tXv5qXPMYlIdR7hyNgxW04A
version: 2.2.0-preview.{build}
version: 2.1.1.{build}
init:
- cmd: git config --global core.autocrlf true

View file

@ -40,19 +40,26 @@ namespace Elsa.Activities.Http.Middleware
var basePath = options.Value.BasePath;
var request = httpContext.Request;
string path;
// If a base path was configured, try to match against that first.
if (basePath != null)
{
// If no match, continue with the next middleware in the pipeline.
if (!request.Path.StartsWithSegments(basePath.Value))
if (!request.Path.StartsWithSegments(basePath.Value, out _, out var remainingPath))
{
await _next(httpContext);
return;
}
path = remainingPath.Value.ToLowerInvariant();
}
else
{
path = httpContext.Request.Path.Value.ToLowerInvariant();
}
var cancellationToken = CancellationToken.None; // Prevent half-way request abortion (which also happens when WriteHttpResponse writes to the response).
var path = httpContext.Request.Path.Value.ToLowerInvariant();
var method = httpContext.Request.Method!.ToLowerInvariant();
request.TryGetCorrelationId(out var correlationId);