mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
fetch: fail if flat=yes and dest=existing-dir w/o trailing slash
This commit is contained in:
parent
f3bc8b84b6
commit
36c6d0f748
2 changed files with 19 additions and 0 deletions
|
@ -120,6 +120,11 @@ class ActionModule(ActionBase):
|
|||
|
||||
dest = os.path.expanduser(dest)
|
||||
if flat:
|
||||
if os.path.isdir(to_bytes(dest, errors='surrogate_or_strict')) and not dest.endswith(os.sep):
|
||||
result['msg'] = "dest is an existing directory, use a trailing slash if you want to fetch src into that directory"
|
||||
result['file'] = dest
|
||||
result['failed'] = True
|
||||
return result
|
||||
if dest.endswith(os.sep):
|
||||
# if the path ends with "/", we'll use the source filename as the
|
||||
# destination filename
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue