Skip to content

Commit

Permalink
Fix installer metadata collection (#2517)
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft authored Sep 15, 2022
1 parent fbb11c1 commit e583f91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,11 @@ namespace AppInstaller::Repository::Metadata
AICLI_LOG(Repo, Info, << "Opening InstallerMetadataCollectionContext input file: " << file);
std::ifstream fileStream{ file };

result->InitializePreinstallState(ConvertToUTF16(ReadEntireStream(fileStream)));
auto content = ReadEntireStream(fileStream);
// CppRestSdk's implementation of json parsing does not work with '\0', so trimming them here
content.erase(std::find(content.begin(), content.end(), '\0'), content.end());

result->InitializePreinstallState(ConvertToUTF16(content));

return result;
}
Expand Down
11 changes: 8 additions & 3 deletions src/AppInstallerRepositoryCore/RepositorySource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ namespace AppInstaller::Repository

if (!m_source)
{
SourceList sourceList;
std::unique_ptr<SourceList> sourceList;

// Check for updates before opening.
for (auto& sourceReference : m_sourceReferences)
Expand All @@ -512,9 +512,14 @@ namespace AppInstaller::Repository
// to avoid the progress bar fill up multiple times.
if (BackgroundUpdateSourceFromDetails(details, progress))
{
auto detailsInternal = sourceList.GetSource(details.Name);
if (sourceList == nullptr)
{
sourceList = std::make_unique<SourceList>();
}

auto detailsInternal = sourceList->GetSource(details.Name);
detailsInternal->LastUpdateTime = details.LastUpdateTime;
sourceList.SaveMetadata(*detailsInternal);
sourceList->SaveMetadata(*detailsInternal);
}
else
{
Expand Down

0 comments on commit e583f91

Please sign in to comment.