Skip to content

dropbox: trim ChangeNotify roots case-insensitively - #9702

Merged
ncw merged 1 commit into
rclone:masterfrom
lntutor:fix-dropbox-changenotify-casing
Aug 27, 2026
Merged

ncw merged 1 commit into
rclone:masterfrom
lntutor:fix-dropbox-changenotify-casing

Conversation

@lntutor

@lntutor lntutor commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

What does this change do?

Makes Dropbox ChangeNotify remove the configured remote root without requiring PathDisplay to use the same casing. The relative suffix still comes from the original display path, so callback paths preserve Dropbox display casing.

The prefix matcher advances rune-by-rune and tracks the byte offset in PathDisplay, which also handles case-fold-equivalent Unicode runes with different UTF-8 lengths. Exact-root events become empty and are skipped, sibling paths are not trimmed, and root remotes continue to remove the leading slash.

A fake Dropbox files client drives folder, file, and deleted metadata through the complete ChangeNotify runner.

Validation performed:

  • Red verification on unmodified production code: callbacks received /docs/... absolute paths instead of relative paths
  • Additional red verification: byte-length slicing failed K versus K and exact-root cases
  • RCLONE_CONFIG=/notfound go test ./backend/dropbox -run "TestTrimPrefixFold|TestChangeNotifyTrimsRootCaseInsensitively" -count=20
  • RCLONE_CONFIG=/notfound go test -race ./backend/dropbox -count=1
  • go vet ./backend/dropbox
  • go build
  • RCLONE_CONFIG=/notfound make quicktest

A real Dropbox integration remote was not used.

Linked issue

Fixes #9692

For new or changed backends

This fixes event-path handling in the existing Dropbox backend. The regression uses a fake Dropbox client; real-remote test_all was not run.

Checklist

  • This change is trivial OR it has been discussed and agreed in the linked issue.
  • I have read the contribution guidelines.
  • (If I used AI tools to help write this code) I have read and understood the AI-assisted contributions guidance, and I have tested and take ownership of this change myself.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • (Backend changes only) test_all passes for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.
  • This Pull Request is ready for review.

@lntutor
lntutor requested a review from ncw as a code owner July 30, 2026 18:23
@lntutor

lntutor commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged current master and resolved the additive Dropbox test-helper conflict on exact head c412cb5f07d07da84946c93daff483c74fb84167. Relative to current master, the PR still changes only backend/dropbox/dropbox.go and backend/dropbox/dropbox_internal_test.go. Local verification on the merged tree: targeted ChangeNotify tests at count 20, full Dropbox race tests, go vet ./backend/dropbox, go build, and repository-wide make quicktest all pass. Fresh CI is running on this head.

@lntutor

lntutor commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Current head c412cb5f07d07da84946c93daff483c74fb84167 now has a clean visible CI surface on this exact SHA after the merge-with-master update: linux, linux_386, mac_amd64, mac_arm64, windows, other_os, go1.25, lint, and android-all all completed successfully. The branch remains mergeable, and I do not see remaining contributor-side follow-up on the current PR state.

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

This looks great - thank you :-)

@ncw

ncw commented Aug 3, 2026

Copy link
Copy Markdown
Member

Can you fix the conflicts please and while you are at it, squash into one commit - thanks :-)

fixes rclone#9692

Dropbox is case insensitive and the path_display it returns in
change notifications may not match the case of the configured root.
Before this change the root was trimmed with a case sensitive prefix
match, so when the cases differed the full path was passed to the
ChangeNotify callback and the notification was ignored.

This trims the root case insensitively while preserving the display
case of the remaining path.
@ncw
ncw force-pushed the fix-dropbox-changenotify-casing branch from c412cb5 to 9f6dba9 Compare August 27, 2026 11:26
@ncw

ncw commented Aug 27, 2026

Copy link
Copy Markdown
Member

I fixed the merge conflict and squashed the commits - will merge when CI goes green

@ncw
ncw merged commit 4af6427 into rclone:master Aug 27, 2026
8 of 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: ChangeNotify root trimming assumes matching PathDisplay casing

2 participants