Skip to content

SABnzbd compat: change_cat/change_script only accept a single nzo_id #76

Description

@thedancingdeveloper

Summary

Real SABnzbd's change_cat (and change_script) accept a comma-separated list of nzo_ids in value, applying the change to all of them:

# sabnzbd/api.py:406-416
def _api_change_cat(name, kwargs):
    """API: accepts value(=nzo_id), value2(=category)"""
    nzo_ids = clean_comma_separated_list(kwargs.get("value"))
    cat = kwargs.get("value2")
    if nzo_ids and cat:
        if is_none(cat):
            cat = None
        result = sabnzbd.NzbQueue.change_cat(nzo_ids, cat)
        return report(keyword="status", data=bool(result > 0))
    ...

What rustnzb does instead

handle_change_cat (crates/nzb-web/src/sabnzbd_compat.rs) treats req.value as a single job ID (strip_prefix("SABnzbd_nzo_") + exact/prefix match), so a comma-separated multi-ID value never matches any job and the category change silently fails for all of them. handle_rename has the same single-ID assumption (real SABnzbd's mode=queue&name=rename is single-ID only per job, so that one is fine — but is tracked separately under #72 since it's not reachable via the real endpoint at all).

Impact

A client changing category for multiple selected jobs at once (e.g. bulk re-categorize in a queue UI) fails silently.

Fix

Parse value as a comma-separated list of nzo_ids in handle_change_cat/handle_change_script-equivalent handlers and apply the category to each.

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