mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
st_mtime can be -11644473600 on win64 fat16 vhd
This commit is contained in:
parent
0de09860f6
commit
261236e302
|
@ -1289,7 +1289,7 @@ 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(file.lmod, UTC)
|
zd = datetime.datetime.fromtimestamp(max(0, 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,
|
||||||
|
|
|
@ -1412,7 +1412,7 @@ class HttpCli(object):
|
||||||
desc = "%s - %s" % (tag_a, tag_t) if tag_t and tag_a else (tag_t or tag_a)
|
desc = "%s - %s" % (tag_a, tag_t) if tag_t and tag_a else (tag_t or tag_a)
|
||||||
desc = html_escape(desc, True, True) if desc else title
|
desc = html_escape(desc, True, True) if desc else title
|
||||||
mime = html_escape(guess_mime(title))
|
mime = html_escape(guess_mime(title))
|
||||||
lmod = formatdate(i["ts"])
|
lmod = formatdate(max(0, i["ts"]))
|
||||||
zsa = (iurl, iurl, title, desc, lmod, iurl, mime, i["sz"])
|
zsa = (iurl, iurl, title, desc, lmod, iurl, mime, i["sz"])
|
||||||
zs = (
|
zs = (
|
||||||
"""\
|
"""\
|
||||||
|
@ -1569,7 +1569,7 @@ class HttpCli(object):
|
||||||
for x in fgen:
|
for x in fgen:
|
||||||
rp = vjoin(vtop, x["vp"])
|
rp = vjoin(vtop, x["vp"])
|
||||||
st: os.stat_result = x["st"]
|
st: os.stat_result = x["st"]
|
||||||
mtime = st.st_mtime
|
mtime = max(0, st.st_mtime)
|
||||||
if stat.S_ISLNK(st.st_mode):
|
if stat.S_ISLNK(st.st_mode):
|
||||||
try:
|
try:
|
||||||
st = bos.stat(os.path.join(tap, x["vp"]))
|
st = bos.stat(os.path.join(tap, x["vp"]))
|
||||||
|
@ -3978,7 +3978,7 @@ class HttpCli(object):
|
||||||
if ptop is not None:
|
if ptop is not None:
|
||||||
assert job and ap_data # type: ignore # !rm
|
assert job and ap_data # type: ignore # !rm
|
||||||
sz = job["size"]
|
sz = job["size"]
|
||||||
file_ts = job["lmod"]
|
file_ts = max(0, job["lmod"])
|
||||||
editions["plain"] = (ap_data, sz)
|
editions["plain"] = (ap_data, sz)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -6120,7 +6120,7 @@ class HttpCli(object):
|
||||||
margin = "-"
|
margin = "-"
|
||||||
|
|
||||||
sz = inf.st_size
|
sz = inf.st_size
|
||||||
zd = datetime.fromtimestamp(linf.st_mtime, UTC)
|
zd = datetime.fromtimestamp(max(0, 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,
|
||||||
|
|
|
@ -284,6 +284,7 @@ class Tftpd(object):
|
||||||
if not ptn or not ptn.match(fn.lower()):
|
if not ptn or not ptn.match(fn.lower()):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
tsdt = datetime.fromtimestamp
|
||||||
vn, rem = self.asrv.vfs.get(vpath, "*", True, False)
|
vn, rem = self.asrv.vfs.get(vpath, "*", True, False)
|
||||||
fsroot, vfs_ls, vfs_virt = vn.ls(
|
fsroot, vfs_ls, vfs_virt = vn.ls(
|
||||||
rem,
|
rem,
|
||||||
|
@ -296,7 +297,7 @@ class Tftpd(object):
|
||||||
dirs1 = [(v.st_mtime, v.st_size, k + "/") for k, v in vfs_ls if k in dnames]
|
dirs1 = [(v.st_mtime, v.st_size, k + "/") for k, v in vfs_ls if k in dnames]
|
||||||
fils1 = [(v.st_mtime, v.st_size, k) for k, v in vfs_ls if k not in dnames]
|
fils1 = [(v.st_mtime, v.st_size, k) for k, v in vfs_ls if k not in dnames]
|
||||||
real1 = dirs1 + fils1
|
real1 = dirs1 + fils1
|
||||||
realt = [(datetime.fromtimestamp(mt, UTC), sz, fn) for mt, sz, fn in real1]
|
realt = [(tsdt(max(0, mt), UTC), sz, fn) for mt, sz, fn in real1]
|
||||||
reals = [
|
reals = [
|
||||||
(
|
(
|
||||||
"%04d-%02d-%02d %02d:%02d:%02d"
|
"%04d-%02d-%02d %02d:%02d:%02d"
|
||||||
|
|
Loading…
Reference in a new issue