fix: get_cats reports "*" default-category sentinel - #80
Closed
thedancingdeveloper wants to merge 1 commit into
Closed
fix: get_cats reports "*" default-category sentinel#80thedancingdeveloper wants to merge 1 commit into
thedancingdeveloper wants to merge 1 commit into
Conversation
Real SABnzbd's get_cats calls list_cats(default=False), which leaves the default category's config-internal name "*" untouched -- the "*" -> "Default" substitution only happens for the config UI (default=True). RustNZB returned the display string "Default" instead, which a client that specifically recognizes "*" as the default-category sentinel wouldn't find. Adds sab_resolve_category() to translate "*" back to RustNZB's internal "Default" category name wherever a client-supplied cat value is applied (addfile, addurl, change_cat), so both directions of the boundary translation stay consistent.
Collaborator
Author
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.
Summary
Fixes #73:
mode=get_catsshould report the default category as the literal string"*", not"Default".Verified against
sabnzbd/sabnzbd@5.1.x:_api_get_catsexplicitly callslist_cats(False), so the real response is{"categories": ["*", "movies", "tv", ...]}— the"*"→"Default"substitution only happens for the internal config UI.Impact
Likely related to #65: a client that specifically recognizes
"*"as the default-category sentinel (rather than treating the array as opaque display names) wouldn't find it in RustNZB's response.Fix
handle_get_catsnow emits"*"for the default category. Since RustNZB's own category model still names it"Default"internally, addedsab_resolve_category()to translate"*"back to"Default"wherever a client-suppliedcatvalue is applied (addfile,addurl,change_cat), keeping both directions of the boundary translation consistent.Test plan
cargo test -p nzb-web— addedget_cats_reports_default_category_as_sabnzbd_sentinelandchange_cat_accepts_sabnzbd_default_sentinel.cargo clippy -p nzb-web --all-targets— clean.nzb-webtest suite passes.🤖 Generated with Claude Code