fix: copy files with shutil rather than reading and writing contents
continuous-integration/drone/pr Build is passing

This commit is contained in:
Darragh Elliott
2025-12-10 10:28:36 +00:00
parent ca1960cc47
commit 609a4bd6be
@@ -27,7 +27,7 @@ def _copy_file(target: Path, source_dir: Path, source_file: Path) -> None:
):
logger.debug("Copying %s to %s", source_file, target_file)
target_file.parent.mkdir(parents=True, exist_ok=True)
target_file.write_bytes(source_file.read_bytes())
shutil.copyfile(source_file, target_file)
# preserve file modes
shutil.copymode(source_file, target_file)
@@ -47,7 +47,7 @@ def _copy_minify_file(
minify.file(mime, str(source_file), str(target_file))
else:
# Instead just copy them into place
target_file.write_bytes(source_file.read_bytes())
shutil.copyfile(source_file, target_file)
# preserve file modes
shutil.copymode(source_file, target_file)