fix(shellBridge): validate URL before openExternal to prevent Invalid URL errors#1767
fix(shellBridge): validate URL before openExternal to prevent Invalid URL errors#1767
Conversation
… Invalid URL errors Add URL validation guard using `new URL()` in both shellBridge (Electron) and shellBridgeStandalone (Node.js) before passing to openExternal. Invalid URLs now log a warning and resolve gracefully instead of causing unhandled promise rejections. Fixes ELECTRON-6Z (635 occurrences)
Code Review:fix(shellBridge): validate URL before openExternal to prevent Invalid URL errors (#1767)变更概述本 PR 修复 Sentry 高频错误 ELECTRON-6Z(635 次),原因是 方案评估结论:✅ 方案合理 使用 问题清单🔵 LOW —
|
| # | 严重级别 | 文件 | 问题 |
|---|---|---|---|
| 1 | 🔵 LOW | shellBridge.ts:22、shellBridgeStandalone.ts:40 |
no-new lint 警告,new URL() 未赋值 |
| 2 | 🔵 LOW | shellBridge.test.ts:12-36 |
no-explicit-any 警告,复制自现有模式 |
结论
✅ 批准合并 — 修复逻辑正确,直接解决 Sentry 高频报错,两种 bridge 实现均已覆盖,测试完备(14 个用例全部通过,涵盖合法 URL、非法 URL、空字符串三种场景)。两处 LOW 级警告均不阻断 CI。
本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
Summary
new URL(url)before callingshell.openExternal()in bothshellBridge.tsandshellBridgeStandalone.tsCloses #1766
Sentry Issue
ELECTRON-6Z — 635 occurrences, last seen 3 hours ago
Error:
Error: Invalid URLCulprit:
src/process/bridge/shellBridge.ts:21(shell.openExternal(url))Verification
tsc --noEmit)Test plan
openExternalworks normally with valid URLs (https, http, mailto)