Skip to content

SABnzbd compatibility: POST mode=addurl fails with 400 when request has no multipart body #119

Description

@RegWin32

SABnzbd compatibility: POST mode=addurl fails without multipart body

Prowlarr sends SABnzbd mode=addurl requests as a POST request with all parameters in the query string and no multipart/form-data body.
rustnzb currently rejects this request with:

HTTP/1.1 400 Bad Request
Invalid `boundary` for `multipart/form-data` request

This prevents rustnzb from being used as a SABnzbd download client in Prowlarr for grabbing releases.

PR #70 added addurl support over GET and extracted the shared handle_addurl() logic, but the POST route still appears to require a valid multipart body before handle_addurl() can be reached.

Environment

  • Prowlarr: 2.5.2.5491
  • rustnzb: latest
  • SABnzbd compatibility endpoint: /sabnzbd/api

Minimal reproduction

This request reproduces the problem:

curl -i -X POST \
"http://localhost:9090/sabnzbd/api?mode=addurl&name=https%3A%2F%2Fexample.com%2Ftest.nzb&cat=prowlarr&priority=-100&apikey=REDACTED&output=json"

Result:

HTTP/1.1 400 Bad Request
content-type: text/plain; charset=utf-8

Invalid `boundary` for `multipart/form-data` request

However, adding an otherwise unnecessary multipart field:

curl -i -X POST \
-F "dummy=1" \
"http://localhost:9090/sabnzbd/api?mode=addurl&name=https%3A%2F%2Fexample.com%2Ftest.nzb&cat=prowlarr&priority=-100&apikey=REDACTED&output=json"

causes the multipart boundary error to disappear and rustnzb proceeds to the URL-fetching / addurl logic.

For example, with an intentionally invalid URL this results in an application-level error instead of the multipart parsing error:

{
  "error_kind": "internal_error",
  "human_readable": "Failed to fetch URL: builder error",
  "status": 500
}

This strongly suggests that the POST handler requires the Axum Multipart extractor even for mode=addurl, despite addurl not requiring a file upload or multipart body.

Expected behavior

POST mode=addurl should work without requiring a multipart/form-data body.
Prowlarr sends the SABnzbd request in this form:

POST /sabnzbd/api?mode=addurl&name=<NZB_URL>&cat=prowlarr&priority=-100&apikey=<API_KEY>&output=json

The request parameters are already provided in the query string, so no multipart body should be required for mode=addurl.
Multipart parsing should only be required for operations that actually upload a file, such as mode=addfile.
Ideally, the existing handle_addurl() logic introduced around PR #70 could be reused for both:

GET  mode=addurl
POST mode=addurl

without requiring multipart data for the POST case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions