Commit 31969b4
authored
fix(config): don't panic when --config path can't be converted to URL (#34351)
Passing a `file://` URL (or any other path whose parent can't be turned
into a file URL on the host platform) to `--config` was panicking inside
`resolve_start_dir` at `url_from_directory_path(...).unwrap()`. On
Windows, `--config file:///D:/deno.json` joined with the cwd produced a
parent path that the URL conversion rejected, and the unwrap turned that
into a Deno panic instead of a user-facing error.
This swaps the three unwraps in `resolve_start_dir` for `?` so the
failure is propagated through the existing
`WorkspaceDiscoverError::PathToUrl` variant. Behavior on platforms where
the join already produced a valid path (macOS, Linux) is unchanged.
Fixes #343081 parent 8f1411f commit 31969b4
1 file changed
Lines changed: 27 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1792 | 1792 | | |
1793 | 1793 | | |
1794 | 1794 | | |
1795 | | - | |
1796 | | - | |
1797 | | - | |
1798 | | - | |
1799 | | - | |
1800 | | - | |
1801 | | - | |
1802 | | - | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
1803 | 1800 | | |
1804 | 1801 | | |
1805 | 1802 | | |
1806 | | - | |
| 1803 | + | |
1807 | 1804 | | |
1808 | 1805 | | |
1809 | 1806 | | |
| |||
1825 | 1822 | | |
1826 | 1823 | | |
1827 | 1824 | | |
1828 | | - | |
| 1825 | + | |
1829 | 1826 | | |
1830 | 1827 | | |
1831 | 1828 | | |
| |||
5579 | 5576 | | |
5580 | 5577 | | |
5581 | 5578 | | |
| 5579 | + | |
| 5580 | + | |
| 5581 | + | |
| 5582 | + | |
| 5583 | + | |
| 5584 | + | |
| 5585 | + | |
| 5586 | + | |
| 5587 | + | |
| 5588 | + | |
| 5589 | + | |
| 5590 | + | |
| 5591 | + | |
| 5592 | + | |
| 5593 | + | |
| 5594 | + | |
| 5595 | + | |
| 5596 | + | |
| 5597 | + | |
| 5598 | + | |
5582 | 5599 | | |
5583 | 5600 | | |
5584 | 5601 | | |
| |||
0 commit comments