Skip to content

[QSTR-222] Fix Synology DS2 task creation error 120#701

Open
Doezer wants to merge 6 commits into
release/1.4.0from
claude/synology-task-create-error-2sxg22
Open

[QSTR-222] Fix Synology DS2 task creation error 120#701
Doezer wants to merge 6 commits into
release/1.4.0from
claude/synology-task-create-error-2sxg22

Conversation

@Doezer

@Doezer Doezer commented Jun 23, 2026

Copy link
Copy Markdown
Owner

This pull request makes substantial improvements to the Synology Download Station integration, aligning the implementation with the reverse-engineered, production-proven contract used by Prowlarr. It clarifies and codifies previously undocumented or misunderstood behaviors in both the code and documentation, ensuring robust support for both current and legacy Synology APIs. The changes also add comprehensive regression tests and update documentation to prevent future confusion.

The most important changes are:

Synology Download Station API contract alignment:

  • Adopted Prowlarr’s reverse-engineered contract for both DS2 and legacy APIs in server/downloaders/synology.ts, including correct HTTP methods, parameter quoting, multipart field ordering, and session handling. This includes sending URL/magnet adds as GET requests, using JSON-quoted parameters and special field names for DS2 uploads, and moving _sid to the query string for DS2 POSTs. [1] [2] [3] [4]

Documentation and decision tracking:

  • Added a detailed technical note in docs/synology-download-station-api-notes.md explaining the undocumented behaviors, rationale for implementation choices, and fallback strategies for future debugging.
  • Recorded the architectural decision to follow Prowlarr’s contract in memory/decisions.md, including context and rationale.

Test coverage and regression prevention:

  • Introduced new and updated regression tests in server/__tests__/downloaders_synology_remaining.test.ts, downloaders_clients_regression.test.ts, and downloaders.test.ts to verify correct API usage, parameter quoting, multipart field order, and session handling for both DS2 and legacy endpoints. [1] [2] [3] [4]

Code cleanup:

  • Removed the unnecessary @types/node-7z dependency from package.json.

These changes ensure that the Synology Download Station integration is robust, maintainable, and based on the best available evidence from real-world deployments.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Synology Download Station client to dynamically set the task type to 'nzb' or 'bt' instead of hardcoding it to 'file', depending on whether the download type is 'usenet'. The corresponding regression test has also been updated. The reviewer suggested improving the robustness of this check by also verifying if the file name ends with '.nzb', since request.downloadType is optional and could be undefined.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread server/downloaders/synology.ts Outdated

if (apiName === "SYNO.DownloadStation2.Task") {
formData.append("type", "file");
formData.append("type", request.downloadType === "usenet" ? "nzb" : "bt");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since request.downloadType is optional in DownloadRequest, it might be undefined. To make the task type detection more robust, we can also check if the resolved fileName ends with .nzb to determine if it should be "nzb" instead of defaulting to "bt".

      const isNzb = request.downloadType === "usenet" || fileName.toLowerCase().endsWith(".nzb");
      formData.append("type", isNzb ? "nzb" : "bt");

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c09c8a7996

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/downloaders/synology.ts Outdated
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 6 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
server/downloaders/synology.ts 85.71% 6 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Doezer

Doezer commented Jun 23, 2026

Copy link
Copy Markdown
Owner Author

/deploy tag=test-570

Deployment Summary

  • Environment: test
  • Image: ghcr.io/Doezer/Questarr
  • Docker Hub: doezer/questarr
  • Tags: ghcr.io/doezer/questarr:test-570
    ghcr.io/doezer/questarr:test-sha-52aaa22
    doezer/questarr:test-570
    doezer/questarr:test-sha-52aaa22

Pull and run the image:

docker pull ghcr.io/Doezer/Questarr:$TAG
docker run -d -p 5000:5000 \
  -e POSTGRES_PASSWORD=your_password \
  -e IGDB_CLIENT_ID=your_client_id \
  -e IGDB_CLIENT_SECRET=your_client_secret \
  ghcr.io/Doezer/Questarr:$TAG

@Doezer Doezer force-pushed the claude/synology-task-create-error-2sxg22 branch from 44e4578 to 68e6a3c Compare June 30, 2026 13:34
@Doezer

Doezer commented Jun 30, 2026

Copy link
Copy Markdown
Owner Author

/deploy tag=test-synology

Deployment Summary

  • Environment: test
  • Image: ghcr.io/Doezer/Questarr
  • Docker Hub: doezer/questarr
  • Tags: ghcr.io/doezer/questarr:test-synology
    ghcr.io/doezer/questarr:test-sha-68e6a3c
    doezer/questarr:test-synology
    doezer/questarr:test-sha-68e6a3c

Pull and run the image:

docker pull ghcr.io/Doezer/Questarr:$TAG
docker run -d -p 5000:5000 \
  -e POSTGRES_PASSWORD=your_password \
  -e IGDB_CLIENT_ID=your_client_id \
  -e IGDB_CLIENT_SECRET=your_client_secret \
  ghcr.io/Doezer/Questarr:$TAG

@Doezer Doezer linked an issue Jun 30, 2026 that may be closed by this pull request
@Doezer

Doezer commented Jul 3, 2026

Copy link
Copy Markdown
Owner Author

/deploy tag=test-synology

@Doezer Doezer force-pushed the claude/synology-task-create-error-2sxg22 branch from 6403ed9 to ff57a49 Compare July 4, 2026 09:47
claude and others added 6 commits July 4, 2026 11:50
SYNO.DownloadStation2.Task.create requires type="bt" for torrent file
uploads and type="nzb" for usenet, not the generic "file" value that
was causing every file-upload task to be rejected with error code 120.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013qzSRa2VdVwiXP4pkGmmUw
@types/node-7z@2.1.11 types the old v2 API and wasn't resolving
consistently between local and CI npm installs for node-7z@3.0.0,
causing `tsc` to fail in CI (but not locally) with "could not find
a declaration file for module 'node-7z'". Replace the mismatched
@types package with an ambient declare module stub, matching the
existing client/src/types/lucide-react.d.ts convention.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Doezer Doezer force-pushed the claude/synology-task-create-error-2sxg22 branch from ff57a49 to 0b1dee4 Compare July 4, 2026 09:50
@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

@Doezer

Doezer commented Jul 4, 2026

Copy link
Copy Markdown
Owner Author

/deploy tag=test-synology

Deployment Summary

  • Environment: test
  • Image: ghcr.io/doezer/questarr
  • Docker Hub: doezer/questarr
  • Tags: ghcr.io/doezer/questarr:test-synology
    ghcr.io/doezer/questarr:test-sha-0b1dee4
    doezer/questarr:test-synology
    doezer/questarr:test-sha-0b1dee4
  • SBOM: attached to the image as an attestation, and uploaded as the sbom-questarr-1.4.0-test workflow artifact

Pull and run the image:

docker pull ghcr.io/doezer/questarr:$TAG
docker run -d -p 5000:5000 \
  -e POSTGRES_PASSWORD=your_password \
  -e IGDB_CLIENT_ID=your_client_id \
  -e IGDB_CLIENT_SECRET=your_client_secret \
  ghcr.io/doezer/questarr:$TAG

Inspect the SBOM attestation:

docker buildx imagetools inspect ghcr.io/doezer/questarr:$TAG --format '{{ json (index .SBOM "linux/amd64").SPDX }}'

@Doezer Doezer changed the title Fix Synology DS2 task creation error 120 — use correct type values for file uploads [QSTR-222] Fix Synology DS2 task creation error 120 — use correct type values for file uploads Jul 4, 2026
@makeplane

makeplane Bot commented Jul 4, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@Doezer Doezer changed the title [QSTR-222] Fix Synology DS2 task creation error 120 — use correct type values for file uploads [QSTR-222] Fix Synology DS2 task creation error 120 Jul 4, 2026
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.

Add support for Synology Download Station

2 participants