Commit 7cdcde4
committed
fix(create): sanitize URL host before using it as a cache path segment
Codex review (high): `getExtractionDir` joined `new URL(...).host`
verbatim into `~/.vite-plus/tmp/create-org/<host>/...`. Hosts can
carry a port (`localhost:4873`) or an IPv6 literal (`[::1]:4873`),
both of which contain `:` / `[` / `]` — characters Windows refuses
in path segments. The first `vp create @your-org:foo` against a
non-default-port registry would fail with `EINVAL` on `mkdir`.
Add a `sanitizeHostForPath(host)` helper that replaces the Windows-
illegal characters (`\ / : * ? " < > |` plus `[ ]`) with `_`, and
route the cache path through it. Exported for direct testing; three
new unit tests cover the plain hostname, the port colon, and the
IPv6 bracketed form.
Codex's other finding (P2: `create.defaultTemplate` not discovered
from a non-monorepo nested invocation) is the deferred behavior the
user explicitly chose to leave as-is in this PR — see commit
c83d0634. Skip per that earlier directive.1 parent 4961eb1 commit 7cdcde4
2 files changed
Lines changed: 33 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
90 | 106 | | |
91 | 107 | | |
92 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
16 | 26 | | |
17 | 27 | | |
18 | 28 | | |
| |||
22 | 32 | | |
23 | 33 | | |
24 | 34 | | |
25 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
| |||
0 commit comments