Skip to content

SABnzbd compat: get_cats returns "Default" instead of the real "*" sentinel #73

Description

@thedancingdeveloper

Summary

mode=get_cats should report the default category as the literal string "*", not "Default".

Verified against sabnzbd/sabnzbd @ 5.1.x:

# sabnzbd/api.py:792-793
def _api_get_cats(name, kwargs):
    return report(keyword="categories", data=list_cats(False))

# sabnzbd/api.py:2090-2098
def list_cats(default: bool = True) -> list[str]:
    """Return list of (ordered) categories,
    when default==False use '*' for Default category
    """
    lst = [cat["name"] for cat in config.get_ordered_categories()]
    if default:
        lst.remove("*")
        lst.insert(0, "Default")
    return lst

_api_get_cats explicitly calls list_cats(False), so the real mode=get_cats API response is {"categories": ["*", "movies", "tv", ...]}. The "*"→"Default" substitution in list_cats only happens for the internal config UI (default=True), never for the API.

What rustnzb does instead

handle_get_cats (crates/nzb-web/src/sabnzbd_compat.rs) returns the literal category name "Default" as the first entry instead of "*".

Impact

Likely related to #65: any client that specifically recognizes "*" as the default-category sentinel (rather than treating the array as an opaque list of display names) won't find it in rustnzb's response and may fail to populate or correctly handle the category picker — while "Default" happens to work only because rustnzb's own category model coincidentally also names its default category "Default" internally.

Fix

Return "*" as the sentinel entry from get_cats (and accept it as an alias for the default category in change_cat/addfile/addurl's cat param, mirroring is_none(cat) handling in real SABnzbd's _api_change_cat).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions