diff --git a/src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs b/src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs index c1448181..48a98eb3 100644 --- a/src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs +++ b/src/Downloader.Test/IntegrationTests/DownloadServiceTest.cs @@ -768,4 +768,21 @@ public void TestAddLogger() // assert Assert.NotNull(Logger); } + + [Fact] + public async Task DownloadOnCurrentDirectory() + { + // arrange + Options = GetDefaultConfig(); + var url = DummyFileHelper.GetFileWithNameUrl(Filename, DummyFileHelper.FileSize1Kb); + var path = Filename; + + // act + await DownloadFileTaskAsync(url, path); + + // assert + Assert.True(Package.IsSaveComplete); + Assert.Equal(Filename, Package.FileName); + Assert.True(File.Exists(Package.FileName), "FileName: " + Package.FileName); + } } \ No newline at end of file diff --git a/src/Downloader/AbstractDownloadService.cs b/src/Downloader/AbstractDownloadService.cs index 177f784d..c44832aa 100644 --- a/src/Downloader/AbstractDownloadService.cs +++ b/src/Downloader/AbstractDownloadService.cs @@ -371,7 +371,7 @@ protected async Task StartDownload(string fileName) { Package.FileName = fileName; string dirName = Path.GetDirectoryName(fileName); - if (dirName != null) + if (!string.IsNullOrWhiteSpace(dirName)) { Directory.CreateDirectory(dirName); // ensure the folder is existing } diff --git a/src/Downloader/Downloader.csproj b/src/Downloader/Downloader.csproj index e22d4a85..147acca4 100644 --- a/src/Downloader/Downloader.csproj +++ b/src/Downloader/Downloader.csproj @@ -2,7 +2,7 @@ net8.0;netstandard2.1; latestMajor - 3.3.0 + 3.3.1 3.2.1 3.2.1 Downloader @@ -12,8 +12,7 @@ https://github.com/bezzad/Downloader https://github.com/bezzad/Downloader download-manager, downloader, download, idm, internet, streaming, download-file, stream-downloader, multipart-download - * Fixed package serialization conflicts. -* Fixed some bugs. + * Fixed download file on current path without create directory. issue #174 true Downloader.snk Copyright (C) 2019-2023 Behzad Khosravifar