Skip to content

fix: queue/history delete support multi-ID value and del_files - #82

Closed
thedancingdeveloper wants to merge 1 commit into
mainfrom
fix/75-multi-id-delete
Closed

fix: queue/history delete support multi-ID value and del_files#82
thedancingdeveloper wants to merge 1 commit into
mainfrom
fix/75-multi-id-delete

Conversation

@thedancingdeveloper

Copy link
Copy Markdown
Collaborator

Summary

Fixes #75: real SABnzbd's _api_queue_delete and _api_history_delete both accept a comma-separated list of nzo_ids in value, and _api_history_delete additionally accepts a del_files flag that removes the entry's completed output directory from disk:

# sabnzbd/api.py:197-207
def _api_queue_delete(value, kwargs):
    if value.lower() == "all": ...
    elif items := clean_comma_separated_list(value):
        delete_all_data = bool_conv(kwargs.get("del_files"))
        removed = sabnzbd.NzbQueue.remove_multiple(items, delete_all_data=delete_all_data)
        ...

# sabnzbd/api.py:511-554 (_api_history_delete) similarly accepts a
# comma-separated `value` and a `del_files` flag that frees disk space.

RustNZB's handle_queue_delete/handle_history_delete only matched a single ID (or the literal "all"), and del_files wasn't even a field on SabApiRequest — history-delete never freed disk space regardless of what the client requested.

Fix

  • SabApiRequest gains a del_files field.
  • Both delete handlers now split value on , and act on every matching job/entry, returning {"status": ..., "nzo_ids": [...] } (queue) matching the real shape.
  • handle_history_delete removes the entry's output_dir from disk when del_files is truthy (1/true/yes/on). handle_queue_delete doesn't need equivalent logic — remove_job already always cleans up a job's incomplete work directory.
  • Related fix: the POST handler's catch-all mode dispatch hardcoded value/value2 to None instead of forwarding them from the query string, which would have silently broken these actions (and SABnzbd compat: real priority/rename/purge/sort queue sub-commands are unreachable #72's priority/rename routing) whenever called over POST rather than GET.

Test plan

  • cargo test -p nzb-web — added queue_delete_removes_multiple_comma_separated_ids, history_delete_with_del_files_removes_output_directory, history_delete_without_del_files_keeps_output_directory.
  • cargo clippy -p nzb-web --all-targets — clean.
  • Full nzb-web test suite passes.
  • cargo test -p rustnzb --test global_pause_api (existing consumer of SabApiRequest) passes unchanged.

🤖 Generated with Claude Code

Real SABnzbd's _api_queue_delete and _api_history_delete both accept
a comma-separated list of nzo_ids in `value`, and _api_history_delete
additionally accepts a `del_files` flag that removes the completed
output directory from disk. RustNZB's handlers only matched a single
ID (or the literal "all") and never freed disk space regardless of
del_files.

Also fixes a related gap: the POST handler's catch-all mode dispatch
hardcoded `value`/`value2` to None instead of forwarding them from
the query string, which would have silently broken these (and #72's
priority/rename) sub-commands over POST.
@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: queue/history delete don't support multi-ID value or del_files

1 participant