dropbox: match shared-folder and received-file names case-insensitively - #9869
Merged
Merged
Conversation
…ly - fixes rclone#9706 The Dropbox backend advertises CaseInsensitive: true, but the two shared-mode lookup helpers compared names with an exact, case-sensitive ==, so a shared folder or received file named "Project" could not be found when requested as "project". Use strings.EqualFold in both findSharedFolder and findSharedFile to honour the advertised case-insensitivity. Fixes rclone#9706
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?
The Dropbox backend advertises
CaseInsensitive: true, but the special shared-folder and received-file lookup paths compared names with exact, case-sensitive Go string equality:findSharedFolderusedentry.(*fs.Dir).Remote() == namefindSharedFileusedentry.(*Object).remote == nameThese functions search API listings by hand rather than resolving the name through Dropbox's normal path lookup, so a shared item listed as
Projectwas not found when requested asproject, contrary to the backend's advertised behaviour.This makes both comparisons case-insensitive with
strings.EqualFold, consistent with what the backend advertises. Normal-path handling is unchanged, and this does not touch ChangeNotify (tracked separately in #9692).Fixes #9706.
Tests
Added unit tests in
backend/dropbox/dropbox_internal_test.gocovering case-insensitive shared-folder and received-file lookup, plus the not-found paths. Both fail on unpatched code.They are built on the
newSharingTestFsmock-server helper added in #9796, rather than a hand-rolled fakesharing.Client, so they exercise the real client and do not break when the SDK's interface changes.This is a Dropbox backend change, so a live
go run ./fstest/test_all -backends dropboxrun is worth doing before merge. I do not have a Dropbox account to run that against.