Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

hidrive: fix incorrect modtime after setting a file's modtime

Nick Craig-Wood5d4c2c32a09f
diff --git a/backend/hidrive/hidrive.go b/backend/hidrive/hidrive.go
index 33b2fb09c..cb512bcb0 100644
--- a/backend/hidrive/hidrive.go
+++ b/backend/hidrive/hidrive.go
@@ -888,7 +888,10 @@ func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error {
if err != nil {
return err
}
- o.modTime = modTime
+ // The server stores modtimes with second precision so truncate
+ // here too to keep the in-memory modtime identical to the one a
+ // fresh listing returns.
+ o.modTime = modTime.Truncate(time.Second)
return nil
}