Commit 7919079
fix(n64): don't 422 on Controller Pak images with blank note slots
extractLogicalEntries + countN64ControllerPakEntries iterated every
pakfs ReadDirRoot entry and called fsys.Open on its name. Real-world
mempaks (e.g. MiSTer-written .cpk) expose blank/uninitialised note
slots with empty names, so fsys.Open("") returned "open : invalid
argument" and the whole upload was rejected with HTTP 422
("open controller pak entry \"\""). On a MiSTer SS1 this silently
blocked ALL N64 save-sync (uploaded=0, errors=76/cycle).
Skip empty-named slots in both functions (and make a single unreadable
note non-fatal in extract) so valid Controller Paks sync and blank ones
cleanly validate as "no save entries" instead of crashing. Count and
extract now agree.
Regression test uses a real blank mempak fixture that reproduced the 422.
Co-authored-by: Justin Terry <terafin@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5549005 commit 7919079
3 files changed
Lines changed: 64 additions & 4 deletions
File tree
- backend/cmd/server
- testdata
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
393 | 400 | | |
394 | 401 | | |
395 | | - | |
| 402 | + | |
| 403 | + | |
396 | 404 | | |
397 | 405 | | |
398 | 406 | | |
| |||
418 | 426 | | |
419 | 427 | | |
420 | 428 | | |
421 | | - | |
| 429 | + | |
422 | 430 | | |
423 | 431 | | |
424 | 432 | | |
| |||
448 | 456 | | |
449 | 457 | | |
450 | 458 | | |
451 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
452 | 471 | | |
453 | 472 | | |
454 | 473 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
Binary file not shown.
0 commit comments