Commit b23fd7f
committed
fix: handle nil URL parsing result for colon-containing filenames
Fix xdg-open unable to open files with colons in filename by adding
nil check for URL parsing result. When parsing filenames containing
colons, url.Parse may return nil URL object along with error, causing
nil pointer dereference. The fix adds additional nil check to prevent
crashes and fallback to file URI scheme detection.
Influence:
1. Test opening files with colons in filename (e.g., "file:name.txt")
2. Verify normal file opening functionality remains unaffected
3. Test various special characters in filenames to ensure robustness
4. Check both local files and URLs to confirm proper scheme detection
fix: 修复文件名中包含冒号时xdg-open无法打开的问题
添加对URL解析结果为nil的检查,防止空指针解引用。当解析包含冒号的文件名
时,url.Parse可能返回nil URL对象和错误,导致程序崩溃。修复后程序能正确回
退到文件URI方案检测。
Influence:
1. 测试打开文件名中包含冒号的文件(如"file:name.txt")
2. 验证正常文件打开功能不受影响
3. 测试文件名中包含各种特殊字符以确保鲁棒性
4. 检查本地文件和URL以确保正确的方案检测1 parent a4c9423 commit b23fd7f
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
0 commit comments