mirror of
https://github.com/9001/copyparty.git
synced 2026-02-20 09:19:58 +10:00
@@ -106,14 +106,14 @@ def utime(
|
||||
def utime_c(
|
||||
log: Union["NamedLogger", Any],
|
||||
p: str,
|
||||
ts: int,
|
||||
ts: float,
|
||||
follow_symlinks: bool = True,
|
||||
throw: bool = False,
|
||||
) -> Optional[int]:
|
||||
) -> Optional[float]:
|
||||
clamp = 0
|
||||
ov = ts
|
||||
bp = fsenc(p)
|
||||
now = int(time.time())
|
||||
now = time.time()
|
||||
while True:
|
||||
try:
|
||||
if SYMTIME:
|
||||
|
||||
@@ -2618,7 +2618,7 @@ class HttpCli(object):
|
||||
at = mt = time.time() - lifetime
|
||||
cli_mt = self.headers.get("x-oc-mtime")
|
||||
if cli_mt:
|
||||
bos.utime_c(self.log, path, int(cli_mt), False)
|
||||
bos.utime_c(self.log, path, float(cli_mt), False)
|
||||
|
||||
if nameless and "magic" in vfs.flags:
|
||||
try:
|
||||
|
||||
@@ -63,6 +63,20 @@ Accept-Encoding: gzip
|
||||
fgsfds"""
|
||||
|
||||
|
||||
RCLONE_PUT_FLOAT = """PUT /%s HTTP/1.1
|
||||
Host: 127.0.0.1:3923
|
||||
User-Agent: rclone/v1.67.0
|
||||
Content-Length: 6
|
||||
Authorization: Basic azp1
|
||||
Content-Type: application/octet-stream
|
||||
Oc-Checksum: SHA1:f5e3dc3fb27af53cd0005a1184e2df06481199e8
|
||||
Referer: http://127.0.0.1:3923/
|
||||
X-Oc-Mtime: 1689453578.123
|
||||
Accept-Encoding: gzip
|
||||
|
||||
fgsfds"""
|
||||
|
||||
|
||||
# tcpdump of `rclone delete dav:/a/d1/` (it does propfind recursively and then this on each file)
|
||||
# (note: `rclone rmdirs dav:/a/d1/` does the same thing but just each folder after asserting they're empty)
|
||||
RCLONE_DELETE = """DELETE /%s HTTP/1.1
|
||||
@@ -201,6 +215,11 @@ class TestHttpCli(TC):
|
||||
h, b = self.req(RCLONE_PUT % ("a/fa",))
|
||||
self.assertStart("HTTP/1.1 201 Created\r", h)
|
||||
|
||||
# float x-oc-mtime should be accepted
|
||||
h, b = self.req(RCLONE_PUT_FLOAT % ("a/fb",))
|
||||
self.assertStart("HTTP/1.1 201 Created\r", h)
|
||||
self.assertAlmostEqual(os.path.getmtime("a/fb"), 1689453578.123, places=3)
|
||||
|
||||
# then it does a propfind to confirm
|
||||
h, b = self.req(RCLONE_PROPFIND % ("a/fa",))
|
||||
fns = pfind2ls(b)
|
||||
|
||||
Reference in New Issue
Block a user