Fix (#9921) link opening by resolving existing relative paths (#9942)

This PR fixes an issue in the change I merged yesterday (#9921), which
was reported by @quonb. Apology

I verified the fix by testing a wide range of URL schemes:
```
echo "https://example.com"
echo "http://example.com"
echo "mailto:test@example.com"
echo "ftp://example.com/file.txt"
echo "file:/Users/you/file.txt"
echo "ssh:user@example.com"
echo "git://github.com/user/repo.git"
echo "ssh://example.com/path"
echo "tel:+12123456789"
echo "ipns://example.com/path"
echo "gemini://example.com/"
echo "gopher://example.com/1menu"
echo "news:comp.lang.zig"
  ```
pull/9883/head
Mitchell Hashimoto 2025-12-17 06:24:57 -08:00 committed by GitHub
commit 6b04f75037
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -2048,6 +2048,12 @@ fn resolvePathForOpening(
};
const resolved = try std.fs.path.resolve(self.alloc, &.{ terminal_pwd, path });
std.fs.accessAbsolute(resolved, .{}) catch {
self.alloc.free(resolved);
return null;
};
return resolved;
}