file_copy: Properly apply file permissions

When dst was a directory, the file would be copied properly,
but the permissions would be applied to the parent directory
rather than the copied file.
This commit is contained in:
Nicolas Braud-Santoni 2016-09-12 00:14:30 +02:00
parent 9caf94ee42
commit 9f7038163f
No known key found for this signature in database
GPG key ID: 9D4F88010CFE19E3

View file

@ -69,4 +69,9 @@ class FileCopyCommand(Task):
else:
shutil.copytree(src_path, final_destination)
modify_path(info, file_entry['dst'], file_entry)
if os.path.isfile(src_path) and os.path.isdir(final_destination):
dst = os.path.join(final_destination, os.path.basename(src_path))
else:
dst = final_destination
modify_path(info, dst, file_entry)