mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
fix confusing behavior when reindexing files:
when a file was reindexed (due to a change in size or last-modified timestamp) the uploader-IP would get removed, but the upload timestamp was ported over. This was intentional so there was probably a reason... new behavior is to keep both uploader-IP and upload timestamp if the file contents are unchanged (determined by comparing warks), and to discard both uploader-IP and upload timestamp if that is not the case
This commit is contained in:
parent
a4239a466b
commit
226c7c3045
|
@ -1228,7 +1228,7 @@ class Up2k(object):
|
||||||
abspath = os.path.join(cdir, fn)
|
abspath = os.path.join(cdir, fn)
|
||||||
nohash = reh.search(abspath) if reh else False
|
nohash = reh.search(abspath) if reh else False
|
||||||
|
|
||||||
sql = "select w, mt, sz, at from up where rd = ? and fn = ?"
|
sql = "select w, mt, sz, ip, at from up where rd = ? and fn = ?"
|
||||||
try:
|
try:
|
||||||
c = db.c.execute(sql, (rd, fn))
|
c = db.c.execute(sql, (rd, fn))
|
||||||
except:
|
except:
|
||||||
|
@ -1237,7 +1237,7 @@ class Up2k(object):
|
||||||
in_db = list(c.fetchall())
|
in_db = list(c.fetchall())
|
||||||
if in_db:
|
if in_db:
|
||||||
self.pp.n -= 1
|
self.pp.n -= 1
|
||||||
dw, dts, dsz, at = in_db[0]
|
dw, dts, dsz, ip, at = in_db[0]
|
||||||
if len(in_db) > 1:
|
if len(in_db) > 1:
|
||||||
t = "WARN: multiple entries: [{}] => [{}] |{}|\n{}"
|
t = "WARN: multiple entries: [{}] => [{}] |{}|\n{}"
|
||||||
rep_db = "\n".join([repr(x) for x in in_db])
|
rep_db = "\n".join([repr(x) for x in in_db])
|
||||||
|
@ -1259,6 +1259,8 @@ class Up2k(object):
|
||||||
db.n += 1
|
db.n += 1
|
||||||
in_db = []
|
in_db = []
|
||||||
else:
|
else:
|
||||||
|
dw = ""
|
||||||
|
ip = ""
|
||||||
at = 0
|
at = 0
|
||||||
|
|
||||||
self.pp.msg = "a%d %s" % (self.pp.n, abspath)
|
self.pp.msg = "a%d %s" % (self.pp.n, abspath)
|
||||||
|
@ -1282,8 +1284,12 @@ class Up2k(object):
|
||||||
|
|
||||||
wark = up2k_wark_from_hashlist(self.salt, sz, hashes)
|
wark = up2k_wark_from_hashlist(self.salt, sz, hashes)
|
||||||
|
|
||||||
|
if dw and dw != wark:
|
||||||
|
ip = ""
|
||||||
|
at = 0
|
||||||
|
|
||||||
# skip upload hooks by not providing vflags
|
# skip upload hooks by not providing vflags
|
||||||
self.db_add(db.c, {}, rd, fn, lmod, sz, "", "", wark, "", "", "", at)
|
self.db_add(db.c, {}, rd, fn, lmod, sz, "", "", wark, "", "", ip, at)
|
||||||
db.n += 1
|
db.n += 1
|
||||||
ret += 1
|
ret += 1
|
||||||
td = time.time() - db.t
|
td = time.time() - db.t
|
||||||
|
|
Loading…
Reference in a new issue