Commit 03e8cfc
committed
fix(cli): make
The custom-URL feature added in #13848 has been broken since release: any
value passed via `--url` is silently dropped (when the URL has no trailing
slash) or rejected by the post-construction guard (when it does), so the
flag cannot succeed under any input.
Two interlocking defects in `download_model`:
1. When `base_url` (= the user's custom URL) lacked a trailing slash, line
183 reassigned it to `about.__download_url__ + "/"`, discarding the
user's choice instead of just appending `/`.
2. The line-185 `startswith(about.__download_url__)` guard then rejected
any URL that *was* preserved, because a custom mirror by definition
does not start with the GitHub URL.
This change:
* Appends `/` to the actual `base_url` instead of swapping it for the
default.
* Skips the GitHub-origin guard when `custom_url` is provided. The user
has explicitly opted into a custom source via `--url`; the relative-
path guard is still in force when no `--url` is passed, preserving
the protection from #13848's review thread.
Adds a regression test exercising both trailing-slash variants of `--url`
plus the default-URL path so the relative-path rejection from
`test_download_rejects_relative_urls` keeps working.spacy download --url actually use the custom URL1 parent 0069cf9 commit 03e8cfc
2 files changed
Lines changed: 35 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
186 | 188 | | |
187 | 189 | | |
188 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1237 | 1237 | | |
1238 | 1238 | | |
1239 | 1239 | | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
0 commit comments