From 31101427d34c40800a1579d051e79f072fce9f02 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 27 Jan 2023 21:09:57 +0000 Subject: [PATCH] support downloading blockdev contents --- copyparty/httpcli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 371a1a73..c1bd401c 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -2378,8 +2378,17 @@ class HttpCli(object): if stat.S_ISDIR(st.st_mode): continue + if stat.S_ISBLK(st.st_mode): + fd = bos.open(fs_path, os.O_RDONLY) + try: + sz = os.lseek(fd, 0, os.SEEK_END) + finally: + os.close(fd) + else: + sz = st.st_size + file_ts = max(file_ts, int(st.st_mtime)) - editions[ext or "plain"] = (fs_path, st.st_size) + editions[ext or "plain"] = (fs_path, sz) except: pass if not self.vpath.startswith(".cpr/"):