Repository navigation
web: toolbar USB export sends a string source again - #45
Merged
Merged
Conversation
Wiring openExportModal directly as the toolbar button's click handler passed the click EVENT as its presetSource parameter (added later for the bulk-select bar), so the export request's source field went out as a serialized event object where the API expects a string - every toolbar export (collection or playlist) failed with 400 "cannot unmarshal object into Go struct field .source", while the bulk-select bar, which passes a real string, worked. Reported from the field with exactly that asymmetry, which was the tell. The handler now calls openExportModal() through a closure, and the modal coerces any non-string presetSource to null so future direct handler wiring can't regress the request body. Verified headless: the toolbar button's preview request goes out as source=all again.
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.
What & why
Shoutout to @kayrozen (#44) for finding and reporting this bug!
Exporting from the library toolbar failed with
400 invalid JSON: json: cannot unmarshal object into Go struct field .source of type string, while exporting via the bulk-select bar worked.openExportModal(presetSource, presetLabel)gained its preset parameters for the bulk-select bar, but the toolbar button was wired asexportBtn.onclick = openExportModal- so the click EVENT arrived as presetSource, and the export request'ssourcefield went out as a serialized event object instead of a string. Every toolbar export (collection or a selected playlist) has been broken since the bulk-select feature landed; the bulk path passes a real string and kept working.The handler now calls
openExportModal()through a closure, and the modal coerces any non-string presetSource to null so future direct handler wiring can't regress the request body again. Verified headless with Playwright: clicking the toolbar button now issues/api/export/preview?source=all(previouslysource=[object PointerEvent]).Web UI only; no server-side change.
Hardware testing
Checklist
go build ./...,go vet ./..., andgo test ./...passgofmt -l .is cleanGPL-3.0-or-later) (n/a, no new files)