From fa7768583ac1f6a932a57035c770ae8362dd5c02 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 17 Aug 2020 00:44:22 +0000 Subject: [PATCH] md-editor: tolerate inaccurate mtimes --- copyparty/httpcli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 0533ed1f..09d98c1c 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -667,7 +667,16 @@ class HttpCli(object): # if file exists, chekc that timestamp matches the client's if srv_lastmod >= 0: - if cli_lastmod3 not in [-1, srv_lastmod3]: + same_lastmod = cli_lastmod3 in [-1, srv_lastmod3] + if not same_lastmod: + # some filesystems/transports limit precision to 1sec, hopefully floored + same_lastmod = ( + srv_lastmod == int(srv_lastmod) + and cli_lastmod3 > srv_lastmod3 + and cli_lastmod3 - srv_lastmod3 < 1000 + ) + + if not same_lastmod: response = json.dumps( { "ok": False,