dropbox: add support for shared links (#6608)#9222
Open
pmarkun wants to merge 3 commits intorclone:masterfrom
Open
dropbox: add support for shared links (#6608)#9222pmarkun wants to merge 3 commits intorclone:masterfrom
pmarkun wants to merge 3 commits intorclone:masterfrom
Conversation
Add a new --dropbox-shared-link option that lets rclone read from Dropbox shared link URLs (the "anyone with the link" style, e.g. https://www.dropbox.com/sh/xxx?dl=0). These links are distinct from --dropbox-shared-files (individual files shared to specific accounts) and --dropbox-shared-folders (folders shared to specific accounts). Previously there was no way to list or download from them without first mounting the folder into one's own Dropbox namespace. The implementation uses: - files.ListFolder with the SharedLink field to list folder contents without mounting (non-recursive, as required by the API) - sharing.GetSharedLinkMetadata to validate the link on initialisation and to look up individual objects - sharing.GetSharedLinkFile with a relative Path to download files The mode is read-only: Put, Mkdir, Rmdir, Update and Remove are all blocked. Both file links and folder links are supported. Also removes a stray fmt.Printf debug statement left in listReceivedFiles.
Two bugs found in the initial shared link implementation: 1. The Dropbox API does not populate PathDisplay/PathLower when listing via shared_link - only Name is returned. Using path.Base(info.PathDisplay) resulted in empty string -> path.Base returns ".", causing "Duplicate object" warnings for every entry. Fixed by using info.Name directly. 2. GetSharedLinkFile does not support HTTP range requests. Blocking all OpenOptions prevented rclone copy from working because it passes RangeSeekOption for retry support. Fixed by ignoring options (always download from the beginning), matching the existing shared-files mode behaviour.
Make shared-link mode more robust by enforcing mode exclusivity, encoding API paths, preserving non-notfound metadata errors and handling file links/single-file roots more cleanly.
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.
Hi maintainers, thanks for rclone.
This PR aims to address #6608 by adding Dropbox shared-link support (
--dropbox-shared-link) so users can list/copy from "anyone with the link" links.I want to be transparent: this patch was produced mostly with agentic coding assistance, then validated by me with real runs in my fork. I'm currently using it in this fork for my own workflow, and it has worked for the tests I ran, so I thought it might be useful for others who need this feature.
I'm not a native Go developer, so I fully understand if the implementation style is not what the project expects, or if the maintainers prefer to ignore/close this PR.
What this PR does
--dropbox-shared-linkoption in the Dropbox backendWhat I tested
go build ./backend/dropbox/...golangci-lint run ./backend/dropbox/...go test -v ./backend/dropbox/...(integration requiringTestDropboxwas skipped as expected when not configured)If this is useful but needs refactoring to match project conventions, I'm happy to adjust where I can.