diff --git a/storage/storage.cpp b/storage/storage.cpp index eb56376e3d..a551a58601 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -1204,6 +1204,9 @@ void Storage::DownloadNode(TCountryId const & countryId) if (!node) return; + if (GetNodeStatus(*node).status == NodeStatus::OnDisk) + return; + auto downloadAction = [this](TCountryTreeNode const & descendantNode) { if (descendantNode.ChildrenCount() == 0) diff --git a/storage/storage_integration_tests/storage_downloading_tests.cpp b/storage/storage_integration_tests/storage_downloading_tests.cpp index 9cab7ebf70..484209d533 100644 --- a/storage/storage_integration_tests/storage_downloading_tests.cpp +++ b/storage/storage_integration_tests/storage_downloading_tests.cpp @@ -55,6 +55,24 @@ void InitStorage(Storage & storage, Storage::TProgressFunction const & onProgres } // namespace +UNIT_TEST(SmallMwms_ReDownloadExistedMWMIgnored_Test) +{ + WritableDirChanger writableDirChanger(kMapTestDir); + Storage storage(COUNTRIES_FILE); + TEST(version::IsSingleMwm(storage.GetCurrentDataVersion()), ()); + + InitStorage(storage, [](TCountryId const & countryId, TLocalAndRemoteSize const & mapSize){}); + TEST(!storage.IsDownloadInProgress(), ()); + + storage.DownloadNode(kCountryId); + TEST(storage.IsDownloadInProgress(), ()); + testing::RunEventLoop(); + + TEST(!storage.IsDownloadInProgress(), ()); + storage.DownloadNode(kCountryId); + TEST(!storage.IsDownloadInProgress(), ()); +} + UNIT_TEST(SmallMwms_InterruptDownloadResumeDownload_Test) { WritableDirChanger writableDirChanger(kMapTestDir);