Commit 39ea9d9
fix(usefulproteomicsdatabases): close leaf-guard gap and reorder resume skip
Address the four remaining findings from the PR #1093 re-review:
- DownloadFileAsync now also rejects a bare "." or ".." FileName.
Path.GetFileName returns these unchanged, so they slipped past the
leaf-name guard despite the documented "no '..'" contract.
- Move the overwrite==false && File.Exists short-circuit ahead of
GetHttpsDownloadUrl and Directory.CreateDirectory, so a resume
(overwrite: false) skips an already-present file that has no HTTPS
location (e.g. Aspera-only) instead of throwing, and does no needless
URL resolution or filesystem work.
- Fix the path-traversal test to assert against the real escape target
derived from the fileName parameter (parent dir for "../evil.raw", a
nested subdir for "sub/dir/file.raw") rather than a fixed
_tempDir/evil.raw that neither case ever occupies; add "." and ".." cases.
- Exercise TryGetHttpsDownloadUrl(out ...) in the explicit-HTTPS-preference
test, and add a resume-skip test for an already-present Aspera-only file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent dec927e commit 39ea9d9
2 files changed
Lines changed: 35 additions & 6 deletions
File tree
- mzLib
- Test/DatabaseTests
- UsefulProteomicsDatabases
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| |||
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
230 | 250 | | |
231 | 251 | | |
232 | 252 | | |
| |||
391 | 411 | | |
392 | 412 | | |
393 | 413 | | |
| 414 | + | |
| 415 | + | |
394 | 416 | | |
395 | 417 | | |
396 | 418 | | |
| |||
400 | 422 | | |
401 | 423 | | |
402 | 424 | | |
403 | | - | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
404 | 429 | | |
405 | 430 | | |
406 | 431 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | 166 | | |
170 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
173 | 177 | | |
174 | 178 | | |
175 | 179 | | |
| |||
0 commit comments