fix: guard against empty Version in configured-but-not-loaded package passthrough

PopulatePackages' "configured but not currently loaded" pass-through could
still emit PackageVersion entries with a null/empty Version, reintroducing
the schema issue the loaded-reflection branch's own guard already prevents
(downstream parsers drop entries whose version isn't a string).
This commit is contained in:
jkdevito 2026-07-10 13:03:28 -05:00
parent 4631d3a537
commit 4a366a5a51

View file

@ -186,8 +186,11 @@ public class GetPackageManifestRequestHandler : WebApiBaseRequestHandler
}
}
// Configured but not currently loaded - pass through unchanged
mergedPackages.AddRange(configPackages.Where(p => !matchedConfigPackages.Contains(p)));
// Configured but not currently loaded - pass through unchanged, but keep the same
// "never emit an entry with no version" guarantee as the loaded-reflection branch above -
// otherwise this branch reintroduces the schema issue that guard is meant to prevent.
mergedPackages.AddRange(configPackages.Where(p =>
!matchedConfigPackages.Contains(p) && !string.IsNullOrEmpty(p.Version)));
result.Packages = mergedPackages;
}