From d1fcbadc1f9b1fd259bc6aa0449b6a6574708f3e Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 14 Jul 2026 12:14:19 +0100 Subject: [PATCH] webdav: fix incorrect modtime after setting a file's modtime SetModTime kept the caller's full precision modtime in memory while the PROPPATCH sets it on the server with second precision, so until the object was re-read the modtime did not match what a fresh listing would report. This broke wrappers which compare exact modtimes, such as the hasher backend's fingerprint and the VFS cache. Truncate the modtime to second precision to match what the server stores. --- backend/webdav/webdav.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/webdav/webdav.go b/backend/webdav/webdav.go index eec9c9e13..172f2c6ae 100644 --- a/backend/webdav/webdav.go +++ b/backend/webdav/webdav.go @@ -1499,8 +1499,11 @@ func (o *Object) SetModTime(ctx context.Context, modTime time.Time) error { } // FIXME check if response is valid if len(result.Responses) == 1 && result.Responses[0].Props.StatusOK() { - // update cached modtime - o.modTime = modTime + // update cached modtime - the PROPPATCH sets it 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 } // got an error, but it's possible it actually worked, so double-check