operations: fix -u/--update with google photos / files of unknown size

Before this change if -u/--update was in effect we compared the size
of the files to see if the transfer should go ahead.  This was
comparing -1 with an actual size so the transfer always proceeded.

After this change we use the existing `sizeDiffers` function which
does the correct comparison with -1 for files of unknown length.

See: https://forum.rclone.org/t/sync-with-google-photos-to-local-drive-will-result-in-recoping/11605
This commit is contained in:
Nick Craig-Wood 2019-09-04 11:47:26 +01:00
parent b3db38ae31
commit 530ba66d35

View File

@ -1527,7 +1527,7 @@ func NeedTransfer(ctx context.Context, dst, src fs.Object) bool {
case dt <= -modifyWindow:
fs.Debugf(src, "Destination is older than source, transferring")
default:
if src.Size() == dst.Size() {
if !sizeDiffers(src, dst) {
fs.Debugf(src, "Destination mod time is within %v of source and sizes identical, skipping", modifyWindow)
return false
}