Commit c0feac2
## 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>
1 parent 389716a commit c0feac2
2 files changed
Lines changed: 48 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
657 | 657 | | |
658 | 658 | | |
659 | 659 | | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
660 | 667 | | |
661 | 668 | | |
662 | 669 | | |
| |||
706 | 713 | | |
707 | 714 | | |
708 | 715 | | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
| 716 | + | |
714 | 717 | | |
715 | 718 | | |
716 | 719 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
0 commit comments