1
mirror of https://github.com/rclone/rclone synced 2024-12-24 15:43:45 +01:00

operations: add size if known to skipped items and JSON log - fixes #4624

This commit is contained in:
Nick Craig-Wood 2020-12-30 13:07:47 +00:00
parent e972f2c98a
commit dd67a3d5f5

View File

@ -2123,7 +2123,15 @@ func SkipDestructive(ctx context.Context, subject interface{}, action string) (s
return false
}
if skip {
fs.Logf(subject, "Skipped %s as %s is set", action, flag)
size := int64(-1)
if do, ok := subject.(interface{ Size() int64 }); ok {
size = do.Size()
}
if size >= 0 {
fs.Logf(subject, "Skipped %s as %s is set (size %v)", fs.LogValue("skipped", action), flag, fs.LogValue("size", fs.SizeSuffix(size)))
} else {
fs.Logf(subject, "Skipped %s as %s is set", fs.LogValue("skipped", action), flag)
}
}
return skip
}