Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dropbox: add support for shared links (#6608)#9222

Open
pmarkun wants to merge 3 commits intorclone:masterfrom
pmarkun:dropbox-shared-links-pr
Open

dropbox: add support for shared links (#6608)#9222
pmarkun wants to merge 3 commits intorclone:masterfrom
pmarkun:dropbox-shared-links-pr

Conversation

@pmarkun
Copy link

@pmarkun pmarkun commented Feb 28, 2026

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

  • Adds --dropbox-shared-link option in the Dropbox backend
  • Supports listing and reading/downloading from shared links
  • Keeps shared-link mode read-only (write operations are blocked)
  • Handles file/folder shared-link cases and shared-link path handling

What I tested

  • go build ./backend/dropbox/...
  • golangci-lint run ./backend/dropbox/...
  • go test -v ./backend/dropbox/... (integration requiring TestDropbox was skipped as expected when not configured)
  • Real-world smoke tests against an actual Dropbox shared link in this fork:
    • listing works
    • copy/copyto works for files I tested

If this is useful but needs refactoring to match project conventions, I'm happy to adjust where I can.

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.
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.

1 participant