1 Commits
Author SHA1 Message Date
Faizan Qureshiandseemeroland c0feac21db Expand ~ in warp://action/new_tab?path= URLs (#9277)
## Description

Fixes #9178. `warp://action/new_tab?path=~/foo` was opening the current
directory instead of `~/foo`. The query value was being passed straight
into `PathBuf::from_str`, which doesn't expand `~`, so the resulting
literal `~/foo` couldn't be resolved by `open_file` and the new tab
silently fell back to the current location.

Routed the `path` query through `shellexpand::tilde` (already a
workspace dependency) before constructing the `PathBuf`. The same call
site serves both `/new_tab` and `/new_window`, so both URLs benefit.
Absolute and relative paths are unchanged.

## Testing

Added 6 unit tests in `app/src/uri/uri_test.rs`:

- `~/Projects` expands to `$HOME/Projects`
- URL-encoded `%7E%2FProjects` expands the same way
- absolute path `/tmp/foo` unchanged
- relative path `relative/dir` unchanged
- missing `path=` returns `None`
- bare `~` expands to `$HOME`

Also verified the helper in a standalone harness against extra edge
cases: empty value, non-leading `~` (unchanged, correct shell
semantics), `~user/path` (unchanged, a shellexpand limitation), and
URL-encoded spaces.

Couldn't run the in-tree test suite locally because the Metal toolchain
isn't installed, so relying on CI for the full clippy / nextest pass.

## Agent Mode
- [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

## Changelog Entries for Stable

CHANGELOG-BUG-FIX: `warp://action/new_tab?path=~/foo` (and
`/new_window`) now expand `~` to your home directory.

---------

Co-authored-by: seemeroland <roland@warp.dev>
2026-04-28 16:00:24 -07:00