dropbox: fix shared folder mount for roots nested more than one level deep - #9868
Merged
Merged
Conversation
… 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
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.
What does this change do?
When
shared_foldersis enabled and the configured root is nested more than one level below the shared folder,NewFsused the entire parent path as the shared-folder lookup name instead of the top-level shared-folder name, so the mount failed to resolve.NewFsderives the lookup value withpath.Dir(f.root), so:findSharedFoldercompares that value against each individual shared folder's name, so the third case can never match and returnsfs.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_foldersdocumentation describes.Fixes #9705.
Tests
Added a unit test in
backend/dropbox/dropbox_internal_test.gocovering 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 dropboxrun 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.