diff --git a/copyparty/up2k.py b/copyparty/up2k.py index f6f6fa20..be36f2ed 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -2954,9 +2954,14 @@ class Up2k(object): self.salt, cj["size"], cj["lmod"], cj["prel"], cj["name"] ) - if vfs.flags.get("up_ts", "") == "fu" or not cj["lmod"]: + zi = cj["lmod"] + bad_mt = zi <= 0 or zi > 0xAAAAAAAA + if bad_mt or vfs.flags.get("up_ts", "") == "fu": # force upload time rather than last-modified cj["lmod"] = int(time.time()) + if zi and bad_mt: + t = "ignoring impossible last-modified time from client: %s" + self.log(t % (zi,), 6) alts: list[tuple[int, int, dict[str, Any], "sqlite3.Cursor", str, str]] = [] for ptop, cur in vols: diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 7e50162f..a0fa380b 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -1409,7 +1409,7 @@ function up2k_init(subtle) { name = good_files[a][1], fdir = evpath, now = Date.now(), - lmod = uc.u2ts ? (fobj.lastModified || now) : 0, + lmod = (uc.u2ts && fobj.lastModified) || 0, ofs = name.lastIndexOf('/') + 1; if (ofs) {