mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(vulnerabilities): do not force exact patch version for NuGet datasource (#31127)
This commit is contained in:
parent
bf43d488d8
commit
fbdb8c2478
4 changed files with 5 additions and 14 deletions
|
@ -17,12 +17,9 @@ beforeEach(() => {
|
|||
|
||||
describe('workers/repository/init/vulnerability', () => {
|
||||
describe('getFixedVersionByDatasource()', () => {
|
||||
it('returns Maven version range', () => {
|
||||
it('returns ecosystem-specific version range', () => {
|
||||
expect(getFixedVersionByDatasource('1.2.3', 'maven')).toBe('[1.2.3,)');
|
||||
});
|
||||
|
||||
it('returns Nuget version', () => {
|
||||
expect(getFixedVersionByDatasource('1.2.3', 'nuget')).toBe('1.2.3');
|
||||
expect(getFixedVersionByDatasource('1.2.3', 'nuget')).toBe('[1.2.3,)');
|
||||
});
|
||||
|
||||
it('returns default version range', () => {
|
||||
|
|
|
@ -43,11 +43,8 @@ export function getFixedVersionByDatasource(
|
|||
fixedVersion: string,
|
||||
datasource: string,
|
||||
): string {
|
||||
if (datasource === MavenDatasource.id) {
|
||||
if (datasource === MavenDatasource.id || datasource === NugetDatasource.id) {
|
||||
return `[${fixedVersion},)`;
|
||||
} else if (datasource === NugetDatasource.id) {
|
||||
// TODO: add support for nuget version ranges when #26150 is merged
|
||||
return fixedVersion;
|
||||
}
|
||||
|
||||
// crates.io, Go, Hex, npm, RubyGems, PyPI
|
||||
|
|
|
@ -997,7 +997,7 @@ describe('workers/repository/process/vulnerabilities', () => {
|
|||
matchDatasources: ['nuget'],
|
||||
matchPackageNames: ['SharpZipLib'],
|
||||
matchCurrentVersion: '1.3.0',
|
||||
allowedVersions: '1.3.3',
|
||||
allowedVersions: '[1.3.3,)',
|
||||
},
|
||||
{
|
||||
matchDatasources: ['npm'],
|
||||
|
|
|
@ -426,11 +426,8 @@ export class Vulnerabilities {
|
|||
fixedVersion: string,
|
||||
ecosystem: Ecosystem,
|
||||
): string {
|
||||
if (ecosystem === 'Maven') {
|
||||
if (ecosystem === 'Maven' || ecosystem === 'NuGet') {
|
||||
return `[${fixedVersion},)`;
|
||||
} else if (ecosystem === 'NuGet') {
|
||||
// TODO: add support for nuget version ranges when #26150 is merged
|
||||
return fixedVersion;
|
||||
}
|
||||
|
||||
// crates.io, Go, Hex, npm, RubyGems, PyPI
|
||||
|
|
Loading…
Reference in a new issue