diff --git a/provisioner/file/provisioner.go b/provisioner/file/provisioner.go index 2b9a6b5fe..49498d08d 100644 --- a/provisioner/file/provisioner.go +++ b/provisioner/file/provisioner.go @@ -109,7 +109,7 @@ func (p *Provisioner) ProvisionDownload(ui packer.Ui, comm packer.Communicator) } } // if the config.Destination was a dir, download the dir - if !strings.HasSuffix(p.config.Destination, "/") { + if strings.HasSuffix(p.config.Destination, "/") { return comm.DownloadDir(src, p.config.Destination, nil) } diff --git a/provisioner/file/provisioner_test.go b/provisioner/file/provisioner_test.go index 53dc315d4..2169c96a3 100644 --- a/provisioner/file/provisioner_test.go +++ b/provisioner/file/provisioner_test.go @@ -192,5 +192,9 @@ func TestProvisionDownloadMkdirAll(t *testing.T) { if _, err := os.Stat(path); err != nil { t.Fatalf("stat of download dir should not error: %s", err) } + + if _, err := os.Stat(config["destination"].(string)); err != nil { + t.Fatalf("stat of destination file should not error: %s", err) + } } }