mirror of
https://github.com/rclone/rclone.git
synced 2025-08-10 06:09:44 +02:00
sync: fix testLoggerVsLsf when backend only reads modtime
There are some backends (like PikPak) that advertise a precision of fs.ModTimeNotSupported but do actually return a modtime when asked. In the case of PikPak, it is because the modtime can be read but not written, and is not considered reliable enough to use for syncing. Before this change, testLoggerVsLsf got confused in this scenario (expected a blank modtime but got non-blank). Adding to the confusion, it only reaches this code if the backend happens to support md5 hashes, and the fsrc and fdst have the same precision. This change fixes the issue by setting the modtime string on both sides to "none" in this scenario. Note that we can't use "" (blank) because (operations.ListFormat).AddModTime would replace that with "2006-01-02 15:04:05".
This commit is contained in:
@@ -3031,6 +3031,9 @@ func DstLsf(ctx context.Context, Fremote fs.Fs) *bytes.Buffer {
|
||||
|
||||
list.SetSeparator(";")
|
||||
timeFormat := operations.FormatForLSFPrecision(Fremote.Precision())
|
||||
if Fremote.Precision() == fs.ModTimeNotSupported {
|
||||
timeFormat = "none"
|
||||
}
|
||||
list.AddModTime(timeFormat)
|
||||
list.AddHash(hash.MD5)
|
||||
list.AddSize()
|
||||
@@ -3082,7 +3085,7 @@ func testLoggerVsLsf(ctx context.Context, fdst, fsrc fs.Fs, logger *bytes.Buffer
|
||||
elements := bytes.Split(line, []byte(";"))
|
||||
if len(elements) >= 2 {
|
||||
if !canTestModtime {
|
||||
elements[0] = []byte("")
|
||||
elements[0] = []byte("none")
|
||||
}
|
||||
if !canTestHash {
|
||||
elements[1] = []byte("")
|
||||
|
Reference in New Issue
Block a user