Skip to content

Commit

Permalink
Added extension to size calculation (per code review).
Browse files Browse the repository at this point in the history
  • Loading branch information
jedieaston committed Jan 11, 2022
1 parent 078227f commit 08f42af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/AppInstallerCLICore/Workflows/DownloadFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ namespace AppInstaller::CLI::Workflow
{
// Get file name from download URI
std::filesystem::path filename = GetFileNameFromURI(context.Get<Execution::Data::Installer>()->Url);
std::wstring installerExtension = std::wstring(GetInstallerFileExtension(context));

// Assuming that we find a safe stem value in the URI, use it.
// This should be extremely common, but just in case fall back to the older name style.
if (filename.has_stem() && filename.string().size() < MAX_PATH)
if (filename.has_stem() && ((filename.wstring() + installerExtension).size() < MAX_PATH))
{
filename = filename.stem();
}
Expand All @@ -76,7 +77,7 @@ namespace AppInstaller::CLI::Workflow
filename = Utility::ConvertToUTF16(manifest.Id + '.' + manifest.Version);
}

filename += GetInstallerFileExtension(context);
filename += installerExtension;

return filename;
}
Expand Down

0 comments on commit 08f42af

Please sign in to comment.