Conversation
Prowlarr's /api/v1/search binds `categories` as an array of int, which
requires a repeated query parameter (categories=7000&categories=3030).
searchOnce used url.Values.Set with a comma-joined string, so any format
resolving to more than one category produced categories=7000%2C3030 and
Prowlarr rejected it with 400 Bad Request:
"categories": { "rawValue": "7000,3030",
"errors": [{ "errorMessage": "The value '7000,3030' is not valid." }],
"validationState": "invalid" }
librarry surfaces that upstream failure to the browser as a 502.
This hit audiobook searches (7000,3030) and the "any" format on every
query regardless of search term or indexer. Ebook searches were
unaffected only incidentally, because "7000" is a single value with no
comma to mis-encode.
Add categoryListForFormat, which splits the same list for use with
url.Values.Add. categoriesForFormat is retained for fetchIndexerFeed:
the Newznab feed endpoint takes a comma-joined `cat` parameter, which
is the correct convention there and must not change.
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.
Symptom
Ebook searches work. Audiobook searches always return HTTP 502, on every
query term and every indexer, with no user-visible setting that differs
between the two:
Root cause
ProwlarrClient.searchOnce(backend/internal/acquisition/prowlarr.go)built the category parameter with
url.Values.Setand a comma-joinedstring from
categoriesForFormat:ebook/book7000categories=7000audiobook/audio7000,3030categories=7000%2C3030""/any7000,3030categories=7000%2C3030Prowlarr's
/api/v1/searchbindscategoriesas an array of int, whichin ASP.NET means a repeated parameter, not a comma-separated string.
It rejects the comma-joined form during model binding:
Librarry surfaces that upstream 400 to the browser as a 502.
Ebook searches were unaffected only incidentally: a single category has
no comma to mis-encode.
Confirmed against Prowlarr directly (same query, same indexers):
Fix
Add
categoryListForFormat, which splits the same list so each categoryis appended with
url.Values.Add, producing repeated parameters.categoriesForFormatis deliberately retained:fetchIndexerFeedusesit for the Newznab feed endpoint, where a comma-joined
catparameteris the correct convention. Only the Prowlarr JSON search path changed.
Verification
go build ./...— cleango test ./...— all pass, no regressionsTestProwlarrSearchSendsRepeatedCategoryParamsForAudiobooksfails without the fix (
categories were comma-joined into one parameter)and passes with it
gofmtclean; patch applies cleanly to pristine upstream at the above revision