mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
ignore impossible lastmod on upload; closes #142
android-chrome bug https://issues.chromium.org/issues/393149335 sends last-modified time `-11644473600` for all uploads this has been fixed in chromium, but there might be similar bugs in other browsers, so add server-side and client-side detection for unreasonable lastmod times previously, if the js detected a similar situation, it would substitute the lastmod-time with the client's wallclock, but now the server's wallclock is always preferrred as fallback
This commit is contained in:
parent
e0fe2b97be
commit
5e12abbb9b
|
@ -2954,9 +2954,14 @@ class Up2k(object):
|
||||||
self.salt, cj["size"], cj["lmod"], cj["prel"], cj["name"]
|
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
|
# force upload time rather than last-modified
|
||||||
cj["lmod"] = int(time.time())
|
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]] = []
|
alts: list[tuple[int, int, dict[str, Any], "sqlite3.Cursor", str, str]] = []
|
||||||
for ptop, cur in vols:
|
for ptop, cur in vols:
|
||||||
|
|
|
@ -1409,7 +1409,7 @@ function up2k_init(subtle) {
|
||||||
name = good_files[a][1],
|
name = good_files[a][1],
|
||||||
fdir = evpath,
|
fdir = evpath,
|
||||||
now = Date.now(),
|
now = Date.now(),
|
||||||
lmod = uc.u2ts ? (fobj.lastModified || now) : 0,
|
lmod = (uc.u2ts && fobj.lastModified) || 0,
|
||||||
ofs = name.lastIndexOf('/') + 1;
|
ofs = name.lastIndexOf('/') + 1;
|
||||||
|
|
||||||
if (ofs) {
|
if (ofs) {
|
||||||
|
|
Loading…
Reference in a new issue