From ca04128a3785a00d364c2c95286c50e5e4f08c4b Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sun, 4 Oct 2026 14:15:45 +0200 Subject: [PATCH] lib.util.copy(): Copy file types The file type framework gives mkdir() and put() an ftype argument, but copy() calls them untyped, so the source's node types are discarded at the landing: a destination that applies its own node types receives only the defaults. This commit threads the source's types through. Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.1.0 --- src/python/jw/pkg/lib/util.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/python/jw/pkg/lib/util.py b/src/python/jw/pkg/lib/util.py index 0a3cf7d0..d5cc0fd5 100644 --- a/src/python/jw/pkg/lib/util.py +++ b/src/python/jw/pkg/lib/util.py @@ -198,7 +198,7 @@ async def copy( ret: list[str] = [] s_st = await ctx.src.stat(src_path) if dst_path and not await ctx.dst.is_dir(dst_path): - await ctx.dst.mkdir(dst_path) + await ctx.dst.mkdir(dst_path, ftype = s_st.ftype) for dirent in await ctx.src.readdir(src_path): s_path = f'{src_path}/{dirent}' if src_path else dirent d_path = f'{dst_path}/{dirent}' if dst_path else dirent @@ -213,6 +213,7 @@ async def copy( owner = owner, group = group, mode = mode, + ftype = s_st.ftype, throw = True, ) ret.append(d_path) @@ -242,6 +243,7 @@ async def copy( owner = owner, group = group, mode = mode, + ftype = (await ctx.src.stat(src_root)).ftype, throw = True, ) return ret