From 3adb103fc465304abe693a0bdf1d4e9ff4db7ace Mon Sep 17 00:00:00 2001 From: Glax Date: Mon, 22 Apr 2024 03:02:49 +0200 Subject: [PATCH] Fix API-Path prematurely triggering match. --- Tranga/Server/Server.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tranga/Server/Server.cs b/Tranga/Server/Server.cs index b2f779b..d62b430 100644 --- a/Tranga/Server/Server.cs +++ b/Tranga/Server/Server.cs @@ -127,7 +127,7 @@ public partial class Server : GlobalBase, IDisposable if (_apiRequestPaths.Any(p => p.HttpMethod == request.HttpMethod && Regex.IsMatch(path, p.RegexStr))) //Check if Request-Path is valid { RequestPath requestPath = - _apiRequestPaths.First(p => p.HttpMethod == request.HttpMethod && Regex.IsMatch(path, p.RegexStr)); + _apiRequestPaths.First(p => p.HttpMethod == request.HttpMethod && Regex.Match(path, p.RegexStr).Length == path.Length); responseMessage = requestPath.Method.Invoke(Regex.Match(path, requestPath.RegexStr).Groups, requestParams); //Get HttpResponse content }