From 8350029e25db6415d2080ba69b974710705c3700 Mon Sep 17 00:00:00 2001 From: Will Thames Date: Thu, 2 Aug 2012 16:02:15 +1000 Subject: [PATCH] Revert acceptance of directory as dest for copy Although library/copy can be corrected to understand that dest is a directory, I can't see how to let _execute_copy know this and let the file module know. As a better solution than before #733, the copy module now explicitly (rather than silently) fails when dest is a directory. --- copy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copy b/copy index 7284a12abf0..b0c24bb3125 100755 --- a/copy +++ b/copy @@ -49,7 +49,7 @@ def main(): module.fail_json(msg="Destination %s not readable" % (dest)) # Allow dest to be directory without compromising md5 check if (os.path.isdir(dest)): - dest = os.join(dest, os.path.basename(src)) + module.fail_json(msg="Destination %s cannot be a directory" % (dest)) md5sum_dest = module.md5(dest) else: if not os.access(os.path.dirname(dest), os.W_OK):