fix(n64): don't 422 on Controller Pak images with blank note slots#12
Merged
Merged
Conversation
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: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6962b0b to
8b37db2
Compare
Contributor
Author
|
Just pushed a cleaner version of this PR — earlier it accidentally included 5 fork-infrastructure workflow files (our fork's CI plumbing for HEAD-tracked image publishing) that shouldn't go upstream. Now scoped to just the 3 files that actually fix the empty-slot issue. Sorry for the noise! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Real-world N64 Controller Pak (.cpk) mempaks (e.g. MiSTer-written) contain blank/uninitialised note slots with empty names.
extractLogicalEntries+countN64ControllerPakEntriescalledfsys.Open(dirEntry.Name())on every root entry, sofsys.Open("")→open : invalid argumentand the entire 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).Fix: skip empty-named slots in both functions (and make a single unreadable note non-fatal in extract). Valid Controller Paks now sync; blank ones validate cleanly as "no save entries" instead of crashing; count and extract agree.
Test:
TestN64ControllerPakEmptySlotDoesNotErroruses a real blank mempak fixture that reproduced the 422 (fails before, passes after). Full server suite green.🤖 Generated with Claude Code