mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
clamp lastmod to y6325 (closes #1470);
fromtimestamp fails on year>9999
This commit is contained in:
parent
926c6e814d
commit
27031f73be
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
S_VERSION = "2.20"
|
S_VERSION = "2.21"
|
||||||
S_BUILD_DT = "2026-04-22"
|
S_BUILD_DT = "2026-05-25"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
u2c.py: upload to copyparty
|
u2c.py: upload to copyparty
|
||||||
|
|
@ -1311,7 +1311,8 @@ class Ctl(object):
|
||||||
if self.ar.jw:
|
if self.ar.jw:
|
||||||
print("%s %s" % (wark, vp))
|
print("%s %s" % (wark, vp))
|
||||||
else:
|
else:
|
||||||
zd = datetime.datetime.fromtimestamp(max(0, file.lmod), UTC)
|
tsdt = datetime.datetime.fromtimestamp
|
||||||
|
zd = tsdt(max(0, min(2 << 36, file.lmod)), UTC)
|
||||||
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
||||||
zd.year,
|
zd.year,
|
||||||
zd.month,
|
zd.month,
|
||||||
|
|
|
||||||
|
|
@ -7238,7 +7238,7 @@ class HttpCli(object):
|
||||||
margin = "-"
|
margin = "-"
|
||||||
|
|
||||||
sz = inf.st_size
|
sz = inf.st_size
|
||||||
zd = datetime.fromtimestamp(max(0, linf.st_mtime), UTC)
|
zd = datetime.fromtimestamp(max(0, min(2 << 36, linf.st_mtime)), UTC)
|
||||||
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
dt = "%04d-%02d-%02d %02d:%02d:%02d" % (
|
||||||
zd.year,
|
zd.year,
|
||||||
zd.month,
|
zd.month,
|
||||||
|
|
|
||||||
|
|
@ -3077,7 +3077,7 @@ class Up2k(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
zi = cj["lmod"]
|
zi = cj["lmod"]
|
||||||
bad_mt = zi <= 0 or zi > 0xAAAAAAAA
|
bad_mt = zi <= 0 or zi > (2 << 36)
|
||||||
if bad_mt or vfs.flags.get("up_ts", "") == "fu":
|
if bad_mt or vfs.flags.get("up_ts", "") == "fu":
|
||||||
# force upload time rather than last-modified
|
# force upload time rather than last-modified
|
||||||
cj["lmod"] = int(time.time())
|
cj["lmod"] = int(time.time())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue