fix(downloader): apply url_base to download-client base URL (#369)#375
Merged
vavallee merged 1 commit intovavallee:mainfrom Apr 24, 2026
Merged
Conversation
…#369) Every downloader client (qbittorrent, transmission, deluge, nzbget, sabnzbd) built its connection URL from host:port only. The url_base column is read from the DB into DownloadClient.URLBase but was never interpolated into the URL, so operators running an *arr-compatible client behind a reverse-proxy subpath (e.g. Host `192.168.1.10:8080`, URL Base `/qbit`) saw Bindery connect to http://192.168.1.10:8080/api/... instead of http://192.168.1.10:8080/qbit/api/... Add an internal helper `internal/downloader/urlbase` that normalises user input (trims whitespace, enforces a single leading slash, strips trailing slashes, tolerates a pasted full URL by keeping only the path). Thread `urlBase` through each client's New constructor and apply the normalised prefix to `baseURL` / Transmission's RPC `Path`. Every call site in `internal/downloader/adapter.go` and `internal/importer/scanner.go` now passes `client.URLBase`. Empty / whitespace url_base collapses to "" so existing deployments without a proxy continue to connect with the historical URL shape. Fixes vavallee#369 Signed-off-by: SAY-5 <say.apm35@gmail.com>
3 tasks
vavallee
approved these changes
Apr 24, 2026
Owner
vavallee
left a comment
There was a problem hiding this comment.
Clean implementation — dedicated urlbase package is the right call, and the paste-full-URL normalisation is a nice UX touch that the other approach missed. All checks look good on our side; approving to trigger CI.
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
Every downloader client (qbittorrent, transmission, deluge, nzbget, sabnzbd) built its connection URL from
host:portonly. Theurl_basecolumn is read from the DB intoDownloadClient.URLBasebut never interpolated into the URL, so operators running an *arr-compatible client behind a reverse-proxy subpath (e.g. Host192.168.1.10:8080, URL Base/qbit) saw Bindery connect tohttp://192.168.1.10:8080/api/...instead ofhttp://192.168.1.10:8080/qbit/api/....Fix
internal/downloader/urlbasehelper that normalises user input: trims whitespace, enforces a single leading slash, strips trailing slashes, and tolerates a pasted full URL by keeping only the path segment.urlBaseparameter through each client'sNewconstructor and apply the normalised prefix tobaseURL/ Transmission's RPCPath.internal/downloader/adapter.goandinternal/importer/scanner.goto passclient.URLBase.url_basecollapses to"", preserving the pre-Download client ignores url_base field — reverse proxy subpath not applied #369 URL shape for deployments without a proxy.Fixes #369
Test plan
go build ./...go test ./...— full suite green, including the existing per-client tests (deluge / nzbget / qbittorrent / sabnzbd / transmission) and the newinternal/downloader/urlbasetable-testNewcall site inadapter.goandscanner.goto confirmclient.URLBaseis wired in