Skip to content

Commit

Permalink
Handle installer download cancelled case before retrying on zero byte…
Browse files Browse the repository at this point in the history
… download (#5141)

Manually validated cancel works without retrying.
  • Loading branch information
yao-msft authored Jan 16, 2025
1 parent 610efd6 commit 1875ba7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/AppInstallerCLICore/Workflows/DownloadFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ namespace AppInstaller::CLI::Workflow
std::placeholders::_1,
downloadInfo));

// User cancelled.
if (downloadResult.Sha256Hash.empty())
{
context.Reporter.Info() << Resource::String::Cancelled << std::endl;
AICLI_TERMINATE_CONTEXT(E_ABORT);
}

if (downloadResult.SizeInBytes == 0)
{
AICLI_LOG(CLI, Info, << "Got zero byte file; retrying download after a short wait...");
Expand Down Expand Up @@ -482,12 +489,6 @@ namespace AppInstaller::CLI::Workflow
}
}

if (downloadResult.Sha256Hash.empty())
{
context.Reporter.Info() << Resource::String::Cancelled << std::endl;
AICLI_TERMINATE_CONTEXT(E_ABORT);
}

context.Add<Execution::Data::DownloadHashInfo>(std::make_pair(installer.Sha256, downloadResult));
}

Expand Down

0 comments on commit 1875ba7

Please sign in to comment.