fix: support mode=addurl over GET so category is honored - #70
Merged
Conversation
NZB360 (and real SABnzbd) add search results by issuing a plain GET request with mode=addurl, since there's no file body to upload — only the multipart POST path applied the cat/priority/password overrides for that mode, so GET requests silently fell through to the "Unknown mode" branch and any requested category was dropped. Extract the URL-fetch-and-enqueue logic into a shared handle_addurl() used by both the GET and POST entry points.
4 tasks
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
mode=addurlas a plain GET request, since there's no file body to upload. The GET route only dispatched a fixed set of modes and had no case foraddurl/addfile, so these requests fell into the "Unknown mode" branch and anycat(category),priority, orpasswordthe client sent was silently dropped — hence "can't change the category" when adding via search.handle_addurl()used by bothh_sabnzbd_api_getandh_sabnzbd_api_post, so GET requests now applycat/priority/passwordexactly like POST does.Test plan
cargo test -p nzb-web— addedaddurl_over_get_applies_requested_category, which spins up a tiny local TCP server serving a sample NZB, issues a GETmode=addurl&cat=moviesrequest throughh_sabnzbd_api_get, and asserts a successful response with annzo_id.cargo clippy -p nzb-web --all-targets— clean.🤖 Generated with Claude Code