Skip to content

Commit

Permalink
Ignore corrupted source data (#4291)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryfu-msft authored Mar 25, 2024
1 parent 577d8fe commit faf9ec1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/AppInstallerCLITests/Sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ TEST_CASE("RepoSources_InvalidYAML", "[sources]")
{
SetSetting(Stream::UserSources, "Name: Value : BAD");

REQUIRE_THROWS_HR(GetSources(), APPINSTALLER_CLI_ERROR_SOURCES_INVALID);
REQUIRE_NOTHROW(GetSources());
}

TEST_CASE("RepoSources_MissingField", "[sources]")
{
SetSetting(Stream::UserSources, s_SingleSource_MissingArg);

REQUIRE_THROWS_HR(GetSources(), APPINSTALLER_CLI_ERROR_SOURCES_INVALID);
REQUIRE_NOTHROW(GetSources());
}

TEST_CASE("RepoSources_AddSource", "[sources]")
Expand Down Expand Up @@ -1300,4 +1300,4 @@ TEST_CASE("RepoSources_BuiltInDesktopFrameworkSourceAlwaysCreatable", "[sources]
{
Source source(WellKnownSource::DesktopFrameworks);
REQUIRE(source);
}
}
5 changes: 4 additions & 1 deletion src/AppInstallerRepositoryCore/SourceList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ namespace AppInstaller::Repository
else
{
std::vector<SourceDetailsInternal> result;
THROW_HR_IF(APPINSTALLER_CLI_ERROR_SOURCES_INVALID, !TryReadSourceDetails(setting.GetName(), *sourcesStream, rootName, parse, result));
if (!TryReadSourceDetails(setting.GetName(), *sourcesStream, rootName, parse, result))
{
AICLI_LOG(YAML, Error, << "Ignoring corrupted source data.");
}
return result;
}
}
Expand Down

0 comments on commit faf9ec1

Please sign in to comment.