Skip to content

Commit

Permalink
Change to download the source file first (microsoft#100)
Browse files Browse the repository at this point in the history
## Change
Due to issues we are seeing with deploying directly from the URL, this change moves the client to download the msix file first, and deploy it from a local file.  This is intended to be a temporary measure until we can investigate the direct deployment issue further, but it may need to become permanent depending on the result of the investigation.

## Testing
Manually validated that the change works against the production environment with source add and automatic update.
  • Loading branch information
JohnMcPMS authored May 6, 2020
1 parent adbb3da commit dd38bbc
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,41 @@ namespace AppInstaller::Repository::Microsoft
return;
}

winrt::Windows::Foundation::Uri uri(Utility::ConvertToUTF16(packageLocation));
// Due to complications with deployment, download the file and deploy from
// a local source while we investigate further.
bool download = Utility::IsUrlRemote(packageLocation);
std::filesystem::path tempFile;
winrt::Windows::Foundation::Uri uri = nullptr;

if (download)
{
tempFile = Runtime::GetPathToTemp();
tempFile /= GetPackageFullNameFromDetails(details) + ".msix";

Utility::Download(packageLocation, tempFile, progress);

uri = winrt::Windows::Foundation::Uri(tempFile.c_str());
}
else
{
uri = winrt::Windows::Foundation::Uri(Utility::ConvertToUTF16(packageLocation));
}

Deployment::RequestAddPackage(
uri,
winrt::Windows::Management::Deployment::DeploymentOptions::None,
progress);

if (download)
{
// If successful, delete the file
std::filesystem::remove(tempFile);
}
}

void RemoveInternal(const SourceDetails& details, IProgressCallback& callback) override
{
// Begin package removal, but let it run its course without waiting.
AICLI_LOG(Repo, Info, << "Removing package " << GetPackageFullNameFromDetails(details));
AICLI_LOG(Repo, Info, << "Removing package: " << GetPackageFullNameFromDetails(details));
Deployment::RemovePackage(GetPackageFullNameFromDetails(details), callback);
}
};
Expand Down

0 comments on commit dd38bbc

Please sign in to comment.