"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
azurefiles: fix incorrect modtime after uploading a file or setting its modtime
Nick Craig-Wood397c0f872a37
diff --git a/backend/azurefiles/azurefiles.go b/backend/azurefiles/azurefiles.goindex ba49e7850..db0b9262a 100644--- a/backend/azurefiles/azurefiles.go+++ b/backend/azurefiles/azurefiles.go@@ -58,6 +58,9 @@ const (maxFileSize = 4 * fs.TebidefaultChunkSize = 4 * fs.MebistorageDefaultBaseURL = "file.core.windows.net"+ // smbTimePrecision is the precision the server stores+ // modtimes with (100 ns FILETIME ticks)+ smbTimePrecision = 100 * time.Nanosecond)func init() {@@ -598,7 +601,10 @@ func (o *Object) SetModTime(ctx context.Context, t time.Time) error {if err != nil {return fmt.Errorf("unable to set modTime: %w", err)}- o.modTime = t+ // Truncate to the precision the server stores the modtime with+ // to keep the in-memory modtime identical to the one a fresh+ // listing returns.+ o.modTime = t.Truncate(smbTimePrecision)return nil}@@ -769,10 +775,12 @@ func (o *Object) Update(ctx context.Context, in io.Reader, src fs.ObjectInfo, opreturn fmt.Errorf("update: failed to set properties: %w", err)}- // Make sure Object is in sync+ // Make sure Object is in sync, truncating the modtime to the+ // precision the server stores it with so it is identical to the+ // one a fresh listing returnso.size = sizeo.md5 = md5Hash- o.modTime = modTime+ o.modTime = modTime.Truncate(smbTimePrecision)o.contentType = contentTypereturn nil}