fix: Gate E2E URL 解析 — 区分 user:pass@host:port 和 host:port
Some checks failed
Deploy API Server / build-and-unit (push) Successful in 34s
Deploy API Server / current-integration (push) Successful in 29s
Deploy API Server / backward-compat (push) Successful in 0s
Deploy API Server / m-ai-03-synthetic-e2e (push) Failing after 10s
Deploy API Server / deploy (push) Has been skipped

正则修正:
- @([^:@]+):(\d+) — 匹配 @host:port(跳过 user:pass)
- :\/\/([^:@]+):(\d+) — 兜底无认证的 host:port

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
wangdl 2026-06-21 11:22:34 +08:00
parent 14c87ea59f
commit d936bf5ce3

View File

@ -31,7 +31,11 @@ async function checkPort(host: string, port: number, label: string): Promise<voi
} }
async function parseHostPort(url: string, defaultHost: string, defaultPort: number) { async function parseHostPort(url: string, defaultHost: string, defaultPort: number) {
const m = url.match(/@?([^:]+):(\d+)/); // DATABASE_URL: mysql://user:pass@host:port/db
// REDIS_URL: redis://host:port or redis://user:pass@host:port
// Try with @ first (authenticated), then without (no auth)
let m = url.match(/@([^:@]+):(\d+)/);
if (!m) m = url.match(/:\/\/([^:@]+):(\d+)/);
return { host: m?.[1] || defaultHost, port: parseInt(m?.[2] || String(defaultPort), 10) }; return { host: m?.[1] || defaultHost, port: parseInt(m?.[2] || String(defaultPort), 10) };
} }