fix: 修复微信 mp 路由 regex 导致生产启动失败
All checks were successful
Build and Deploy / deploy (push) Successful in 32s
All checks were successful
Build and Deploy / deploy (push) Successful in 32s
ASP.NET 路由模板中方括号需转义为 [[ ]],否则应用在 InitializeApplication 阶段崩溃。
This commit is contained in:
parent
41db6fa0af
commit
0a16f27664
@ -30,7 +30,9 @@ public class WeChatRouteIntegrationTests
|
||||
await using var host = await SimpleAdminApiTestHost.CreateAsync(configureServices: ConfigureWeChatFallback);
|
||||
|
||||
host.RoutePatterns.Should().Contain("apiwechat/verification");
|
||||
host.RoutePatterns.Should().Contain("wechat/mp/{appId:regex(^wx[A-Za-z0-9]+$)}");
|
||||
host.RoutePatterns.Should().Contain(p =>
|
||||
p.StartsWith("wechat/mp/{appId:regex(^wx", StringComparison.Ordinal)
|
||||
&& p.EndsWith("+$)}", StringComparison.Ordinal));
|
||||
host.RoutePatterns.Should().Contain("wechat/mp/login-qrcode");
|
||||
host.RoutePatterns.Should().Contain("wechat/oauth/config");
|
||||
host.RoutePatterns.Should().Contain("wechat/mp/follow-qrcode");
|
||||
|
||||
@ -73,7 +73,7 @@ public partial class AuthService
|
||||
/// appId 仅匹配 wx 开头,避免 login-qrcode / oauth-config 等静态段落入本路由。
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("/wechat/mp/{appId:regex(^wx[A-Za-z0-9]+$)}")]
|
||||
[HttpGet("/wechat/mp/{appId:regex(^wx[[a-zA-Z0-9]]+$)}")]
|
||||
[Produces("text/plain")]
|
||||
[ApiExplorerSettings(GroupName = "WeChat")]
|
||||
public async Task<IActionResult> WeChatValidateAsync(
|
||||
@ -121,7 +121,7 @@ public partial class AuthService
|
||||
/// 微信消息/事件推送(明文,XML/JSON)。
|
||||
/// </summary>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("/wechat/mp/{appId:regex(^wx[A-Za-z0-9]+$)}")]
|
||||
[HttpPost("/wechat/mp/{appId:regex(^wx[[a-zA-Z0-9]]+$)}")]
|
||||
[Consumes("text/xml", "application/xml", "application/json", "text/plain")]
|
||||
[Produces("text/plain", "application/xml")]
|
||||
[ApiExplorerSettings(GroupName = "WeChat")]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user