Skip to content

dropbox: fix shared folder mount for roots nested more than one level deep - #9868

Merged
ncw merged 1 commit into
rclone:masterfrom
hsdfat:fix-dropbox-shared-folders-deep-root
Sep 8, 2026
Merged

ncw merged 1 commit into
rclone:masterfrom
hsdfat:fix-dropbox-shared-folders-deep-root

Conversation

@hsdfat

@hsdfat hsdfat commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What does this change do?

When shared_folders is enabled and the configured root is nested more than one level below the shared folder, NewFs used the entire parent path as the shared-folder lookup name instead of the top-level shared-folder name, so the mount failed to resolve.

NewFs derives the lookup value with path.Dir(f.root), so:

SharedFolder                 -> lookup "SharedFolder"      (ok)
SharedFolder/subdir          -> lookup "SharedFolder"      (ok)
SharedFolder/subdir/deeper   -> lookup "SharedFolder/subdir"  (never matches)

findSharedFolder compares that value against each individual shared folder's name, so the third case can never match and returns fs.ErrorDirNotFound.

This uses only the first path component as the shared-folder name and preserves the remaining components as the mounted root, which is what the shared_folders documentation describes.

Fixes #9705.

Tests

Added a unit test in backend/dropbox/dropbox_internal_test.go covering the shared-folder-name / root derivation for deep roots. It fails on unpatched code.

This is a Dropbox backend change and the added test exercises the pure name-derivation logic, so a full go run ./fstest/test_all -backends dropbox run against a live Dropbox remote with a 2+ level-deep shared folder is worth doing before merge. I do not have a Dropbox account to run that against.

… deep

In shared_folders mode NewFs derived the shared folder name with
path.Dir(f.root), which returns the parent path rather than the first
path component. For a root like "SharedFolder/subdir/deeper" this yielded
"SharedFolder/subdir", which findSharedFolder cannot match, so NewFs
failed with ErrorDirNotFound. Use the first path component of the root,
as the shared_folders option documents, so deeply nested roots mount.

Fixes rclone#9705
@hsdfat
hsdfat requested a review from ncw as a code owner September 5, 2026 14:18

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice fix - thank you

@ncw
ncw merged commit ac7cfcc into rclone:master Sep 8, 2026
9 checks passed
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.

dropbox: deep shared-folder roots use the parent path as the folder name

2 participants