Repository navigation
ftp: fix --ftp-force-list-hidden listing the root on FRITZ!Box - fixes #10324 - #10380
Open
sathvik8317 wants to merge 1 commit into
Open
sathvik8317 wants to merge 1 commit into
sathvik8317 wants to merge 1 commit into
Conversation
…rclone#10324 Some FTP servers, such as the FRITZ!Box, ignore the path after "LIST -a" and list the current directory instead. With --ftp-force-list-hidden this made every directory show the contents of the root, so recursive listings nested forever. When force_list_hidden is set, change into the directory, send "LIST -a" with no path, then change back to the previous directory so pooled connections stay where they were.
3 tasks done
Author
|
The reporter tested this build on Debian 13 against their FRITZ!Box and confirmed it fixes the listing: #10324 (comment) |
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?
With
--ftp-force-list-hidden, rclone sendsLIST -a <path>. Some servers, such as the FRITZ!Box, ignore the path after-aand list the current directory, so every directory showed the contents of the root andrclone lsnested forever.When
force_list_hiddenis set, the backend now doesPWD,CWD <dir>,LIST -awith no path, thenCWDback to the original directory so pooled connections stay where they were. It's used by bothListandfindItem. Without the flag nothing changes.The reporter confirmed the cause with curl in the issue:
LIST -a <path>from the root returns the root, while CWD thenLIST -areturns the folder.Linked issue
Fixes #10324
Testing
TestListDirForceListHidden: a fake FTP server that ignores the path afterLIST -a. It fails on master (returns the root listing) and passes with this change, and it checks the connection is back in its original directory afterwards, including whenCWDfails.go test ./backend/ftp/ -remoteagainst a localrclone serve ftp, withforce_list_hiddenboth off and on: 90 pass in each mode. The only failure isFsMkdir/FsEncoding/punctuation, which also fails on master because I ran the server on a Windows disk.go build,go vetandgolangci-lintare clean forbackend/ftp.go test ./...is clean apart from Windows-only symlink-privilege failures inbackend/localthat also fail on master.test_allagainst the Docker FTP servers locally. The reporter tested a build of this branch on Debian 13 against their FRITZ!Box and confirmed it fixes the listing (comment). CI passes on all platforms.Checklist
test_allpasses for this backend and if submitting a new backend can provide a test account for the integration tester - see CONTRIBUTING.md.