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

vfs: [bugfix] Update dir modification time

Saleh Dindar7801b160f282
diff --git a/vfs/dir.go b/vfs/dir.go
index 511d8db4a..5044ee855 100644
--- a/vfs/dir.go
+++ b/vfs/dir.go
@@ -694,9 +694,10 @@ func (d *Dir) _readDirFromEntries(entries fs.DirEntries, dirTree dirtree.DirTree
if node == nil || !node.IsDir() {
node = newDir(d.vfs, d.f, d, item)
}
+ dir := node.(*Dir)
+ dir.mu.Lock()
+ dir.modTime = item.ModTime(context.TODO())
if dirTree != nil {
- dir := node.(*Dir)
- dir.mu.Lock()
err = dir._readDirFromDirTree(dirTree, when)
if err != nil {
dir.read = time.Time{}
@@ -704,10 +705,10 @@ func (d *Dir) _readDirFromEntries(entries fs.DirEntries, dirTree dirtree.DirTree
dir.read = when
dir.cleanupTimer.Reset(d.vfs.Opt.DirCacheTime * 2)
}
- dir.mu.Unlock()
- if err != nil {
- return err
- }
+ }
+ dir.mu.Unlock()
+ if err != nil {
+ return err
}
default:
err = fmt.Errorf("unknown type %T", item)