support downloading blockdev contents

This commit is contained in:
ed 2023-01-27 21:09:57 +00:00
parent a083dc36ba
commit 31101427d3

View file

@ -2378,8 +2378,17 @@ class HttpCli(object):
if stat.S_ISDIR(st.st_mode): if stat.S_ISDIR(st.st_mode):
continue 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)) 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: except:
pass pass
if not self.vpath.startswith(".cpr/"): if not self.vpath.startswith(".cpr/"):