Skip to content

fix: change_cat accepts multiple comma-separated nzo_ids - #83

Closed
thedancingdeveloper wants to merge 1 commit into
mainfrom
fix/76-change-cat-multi-id
Closed

fix: change_cat accepts multiple comma-separated nzo_ids#83
thedancingdeveloper wants to merge 1 commit into
mainfrom
fix/76-change-cat-multi-id

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Collaborator

Summary

Fixes #76: real SABnzbd's _api_change_cat accepts a comma-separated list of nzo_ids in value, applying the category 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))

RustNZB's handle_change_cat treated value as a single job ID, so a comma-separated multi-ID value (e.g. bulk re-categorize in a queue UI) matched no job and the category change silently failed for all of them.

Fix

handle_change_cat now splits value on , and applies the category to every matching job, returning {"status": true} if at least one changed — matching real SABnzbd's bool(result > 0) semantics.

Test plan

  • cargo test -p nzb-web — added change_cat_applies_to_multiple_comma_separated_ids.
  • cargo clippy -p nzb-web --all-targets — clean.
  • Full nzb-web test suite passes.

🤖 Generated with Claude Code

Real SABnzbd's _api_change_cat parses `value` as a comma-separated
list of nzo_ids via clean_comma_separated_list, applying the category
change to all of them. handle_change_cat treated `value` as a single
job ID, so a multi-ID request (e.g. bulk re-categorize) matched no
job and silently failed for all of them.
@thedancingdeveloper

Copy link
Copy Markdown
Collaborator Author

Superseded — this change landed via #84, which stacked all of #71-#77's fixes together and was squash-merged to save on redundant CI runs. Closing without merging to avoid re-applying the same diff.

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.

SABnzbd compat: change_cat/change_script only accept a single nzo_id

1 participant