Skip to content

Commit

Permalink
Trying to fix corner case related to dangling symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
jmfernandez committed Jul 29, 2023
1 parent 389c230 commit 4122513
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wfexs_backend/utils/contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ def CWLDesc2Content(
return matValues


def copy2_nofollow(src: "str", dest: "str") -> "None":
shutil.copy2(src, dest, follow_symlinks=False)


def link_or_copy(src: "AnyPath", dest: "AnyPath", force_copy: "bool" = False) -> None:
assert os.path.exists(
src
Expand Down Expand Up @@ -303,4 +307,4 @@ def link_or_copy(src: "AnyPath", dest: "AnyPath", force_copy: "bool" = False) ->
# as it is in a separated filesystem
if dest_exists:
shutil.rmtree(dest)
shutil.copytree(src, dest)
shutil.copytree(src, dest, copy_function=copy2_nofollow)

0 comments on commit 4122513

Please sign in to comment.