From e0e4b74c58b4e8406d40da5572a03c4b4c38e00b Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Tue, 17 Dec 2013 21:22:50 +0400 Subject: [PATCH] Fix incorrect creation of directory while downloading. --- utils/download.go | 2 +- utils/download_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/download.go b/utils/download.go index 7876c9c3..7ba6dd99 100644 --- a/utils/download.go +++ b/utils/download.go @@ -92,7 +92,7 @@ func (downloader *downloaderImpl) handleTask(task *downloadTask) { return } - err = os.MkdirAll(filepath.Base(task.destination), 0755) + err = os.MkdirAll(filepath.Dir(task.destination), 0755) if err != nil { task.result <- err return diff --git a/utils/download_test.go b/utils/download_test.go index f16db619..a0e64e5c 100644 --- a/utils/download_test.go +++ b/utils/download_test.go @@ -73,8 +73,8 @@ func (s *DownloaderSuite) TestDownloadFileError(c *C) { d := NewDownloader(2) defer d.Shutdown() - res := <-d.Download("http://smira.ru/", "/no/such/file") - c.Assert(res, ErrorMatches, ".*no such file or directory") + res := <-d.Download("http://smira.ru/", "/") + c.Assert(res, ErrorMatches, ".*permission denied") } func (s *DownloaderSuite) TestDownloadTemp(c *C) {