commit 1875ba78ed996d1bac4d04fc721881b136bafa94
parent 610efd6cbcbd7b6918912d15297ad92da62f876a
Author: yao-msft <50888816+yao-msft@users.noreply.github.com>
Date: Wed, 15 Jan 2025 16:11:31 -0800
Handle installer download cancelled case before retrying on zero byte download (#5141)
Manually validated cancel works without retrying.
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp b/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp
@@ -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...");
@@ -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));
}