mirror of
https://github.com/rclone/rclone.git
synced 2025-08-15 00:02:35 +02:00
local: fix exclusion of dangling symlinks with -L/--copy-links
Before this fix, a dangling symlink was erroring the sync. It was writing an ERROR log and causing rclone to exit with an error. The List method wasn't returning an error though. This fix makes sure that we don't log or report a global error on a file/directory that has been excluded. This feature was first implemented in:a61d219bc
local: fix -L/--copy-links with filters missing directories Then fixed in:8d1fff9a8
local: obey file filters in listing to fix errors on excluded files This commit also adds test cases for the failure modes of those commits. See #6376
This commit is contained in:
@ -524,6 +524,10 @@ func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err e
|
||||
if f.opt.FollowSymlinks && (mode&os.ModeSymlink) != 0 {
|
||||
localPath := filepath.Join(fsDirPath, name)
|
||||
fi, err = os.Stat(localPath)
|
||||
// Quietly skip errors on excluded files and directories
|
||||
if err != nil && useFilter && !filter.IncludeRemote(newRemote) {
|
||||
continue
|
||||
}
|
||||
if os.IsNotExist(err) || isCircularSymlinkError(err) {
|
||||
// Skip bad symlinks and circular symlinks
|
||||
err = fserrors.NoRetryError(fmt.Errorf("symlink: %w", err))
|
||||
|
Reference in New Issue
Block a user