mirror of
https://github.com/rclone/rclone.git
synced 2025-02-22 19:07:58 +08:00

For some files the Windows Volume Shadow Service (VSS) advertises the file size as X in the directory listing but returns a different number Y on stat-ing the file. If the file is opened and read there are Y bytes available for reading. Existing copy tools copy Y bytes rather than X so for consistency rclone should do the same. This fixes the problem by stat-ing the file immediately before opening it. This will also reduce the unnecessary occurrence of "can't copy - source file is being updated" errors; if the file has finished changing by the time we come to copy it then we now can copy it successfully. See: https://forum.rclone.org/t/consistently-getting-corrupted-on-transfer-sizes-differ-syncing-to-an-smb-share/42218/