mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
Properly handle on disk changes
Follows Collabora spec: https://sdk.collaboraonline.com/docs/advanced_integration.html#detecting-external-document-change
This commit is contained in:
parent
f1fe9c6452
commit
8304388d29
|
|
@ -3499,6 +3499,11 @@ class HttpCli(object):
|
|||
if self.do_log:
|
||||
self.log("WOPI POST 'contents': %s" % (full_path))
|
||||
|
||||
last_mod_time = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(os.path.getmtime(full_path)))
|
||||
if self.headers["x-cool-wopi-timestamp"] != last_mod_time:
|
||||
self.reply(json.dumps({"COOLStatusCode": 1010}).encode("utf-8"), 409)
|
||||
return True
|
||||
|
||||
reader, _ = self.get_body_reader()
|
||||
buf = b""
|
||||
for rbuf in reader:
|
||||
|
|
@ -3510,11 +3515,11 @@ class HttpCli(object):
|
|||
with open(full_path, "wb") as file:
|
||||
file.write(buf)
|
||||
|
||||
mod_time = {
|
||||
new_mod_time = {
|
||||
"LastModifiedTime":
|
||||
time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime(os.path.getmtime(full_path)))
|
||||
}
|
||||
ret = json.dumps(mod_time).encode("utf-8", "replace")
|
||||
ret = json.dumps(new_mod_time).encode("utf-8", "replace")
|
||||
self.reply(ret, 200, "application/json; charset=utf-8")
|
||||
return True
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue