Skip to content

Commit b4f2dc4

Browse files
committed
wip copy
1 parent f9cf49f commit b4f2dc4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/copy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import warnings
99

10-
from .errors import ResourceNotFound
10+
from .errors import IllegalDestination, ResourceNotFound
1111
from .opener import manage_fs
12-
from .path import abspath, combine, frombase, normpath
12+
from .path import abspath, combine, frombase, isbase, normpath
1313
from .tools import is_thread_safe
1414
from .walk import Walker
1515

@@ -438,6 +438,8 @@ def copy_dir_if(
438438
dst_fs, create=True
439439
) as _dst_fs:
440440
with _src_fs.lock(), _dst_fs.lock():
441+
if src_fs == dst_fs and isbase(_src_path, _dst_path):
442+
raise IllegalDestination(dst_path)
441443
_thread_safe = is_thread_safe(_src_fs, _dst_fs)
442444
with Copier(
443445
num_workers=workers if _thread_safe else 0, preserve_time=preserve_time

0 commit comments

Comments
 (0)