Skip to content

Return 400 for an invalid track selection - #554

Open
ditschi wants to merge 2 commits into
toniebox-reverse-engineering:developfrom
ditschi:fix/track-export-invalid-track-400
Open

ditschi wants to merge 2 commits into
toniebox-reverse-engineering:developfrom
ditschi:fix/track-export-invalid-track-400

Conversation

@ditschi

@ditschi ditschi commented Oct 18, 2026

Copy link
Copy Markdown

Depends on #553. This branch is based on it, so until #553 is merged the diff also shows its commit. Only the top commit belongs to this PR.

Problem

An invalid tracks= value (out of range, non-numeric, or empty, e.g. tracks=9, tracks=abc, tracks=,) made the track export return an error code without sending a response. The server then dropped the connection, and a reverse proxy reports that as 502. This affects both /content/<path>?tracks=… and /content/download/<ruid>?tracks=….

Change

handleApiContentTrackExport answers an invalid track selection with 400 Invalid track selection.

Tests

tests/py/test_track_export.py checks tracks=9, tracks=0, tracks=abc and tracks=, on both routes and expects 400. The previous test accepted a dropped connection.

Related: toniebox-reverse-engineering/teddycloud_web#350

🤖 Generated with Claude Code

Christian Ditscher and others added 2 commits October 17, 2026 21:20
The web UI's tonie card builds the track download from the tag's audioUrl
(/content/download/<ruid>), but only /content/<path> handled tracks=, so
the whole TAF was served as Ogg instead of a zip. Resolve the tag's source
(e.g. lib://) and use the same track export as /content/.

Refs toniebox-reverse-engineering/teddycloud_web#350

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An out-of-range, non-numeric or empty tracks= value made the track
export return an error code without sending a response, so the server
dropped the connection (a reverse proxy shows this as 502). Answer with
400 on both /content/ and /content/download/ instead.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant