qinchaoyue 1 сар өмнө
parent
commit
0e29edcbcd

+ 2 - 1
src/Hotline.Api/Controllers/FilterController/ExportDataController.cs

@@ -54,7 +54,8 @@ public class ExportDataController : BaseController
             .Where(endpoint => endpoint.RoutePattern.RawText == originalPath)
             .ToList()
             ?? throw UserFriendlyException.SameMessage($"根据URL查询路由失败: {originalPath}");
-        var matchingEndpoint = matchingEndpoints.First();
+        var matchingEndpoint = matchingEndpoints.FirstOrDefault();
+        if (matchingEndpoint == null) throw UserFriendlyException.SameMessage($"根据URL查询路由失败: {originalPath}");
         if (matchingEndpoints.Count > 1)
         {
             matchingEndpoint = matchingEndpoints.First(m => m.DisplayName.Contains("Get"));