From 56d46f3f7e178dd0e42e155bfbc815f2decd301c Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Wed, 24 Dec 2025 12:20:46 +1000 Subject: [PATCH] Fix copy/copy2 kwargs handling Make sure that the kwargs for copy and copy2 are passed down to the underlying function that does the file and metadata copying. --- CHANGELOG.md | 1 + src/smbclient/shutil.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91b4c5b..a475570 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 1.16.0 - TBD * Drop support for Python 3.8, minimum version is now 3.9 +* Fix up `smbclient.shutil.copy` and `smbclient.shutil.copy2` to properly pass along the connection `kwargs` to the internal copy call ## 1.15.0 - 2024-11-12 diff --git a/src/smbclient/shutil.py b/src/smbclient/shutil.py index 1e67fca..0948b64 100644 --- a/src/smbclient/shutil.py +++ b/src/smbclient/shutil.py @@ -452,8 +452,8 @@ def _copy(src, dst, follow_symlinks, copy_meta_func, **kwargs): if (is_remote_path(ntpath.normpath(dst)) and isdir(dst, **kwargs)) or os.path.isdir(dst): dst = _join_local_or_remote_path(dst, _basename(src)) - copyfile(src, dst, follow_symlinks=follow_symlinks) - copy_meta_func(src, dst, follow_symlinks=follow_symlinks) + copyfile(src, dst, follow_symlinks=follow_symlinks, **kwargs) + copy_meta_func(src, dst, follow_symlinks=follow_symlinks, **kwargs) return dst