New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

snyk-nuget-plugin

Package Overview
Dependencies
Maintainers
0
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snyk-nuget-plugin - npm Package Compare versions

Comparing version 2.7.13 to 2.7.14

75

dist/nuget-parser/parsers/csproj-parser.js

@@ -24,2 +24,14 @@ "use strict";

}
function readEncodedFile(path) {
const buffer = fs.readFileSync(path);
const firstChar = buffer.readUInt16LE(0);
let contents;
if (firstChar === 0xfeff) {
contents = buffer.toString('utf16le');
}
else {
contents = buffer.toString('utf8');
}
return contents;
}
function getTargetFrameworksFromProjFile(rootDir) {

@@ -33,36 +45,41 @@ debug('Looking for your .csproj file in ' + rootDir);

debug(`Checking .NET framework version in .csproj file ${csprojPath}`);
const csprojContents = fs.readFileSync(csprojPath, 'utf-8');
const csprojContents = readEncodedFile(csprojPath);
let result = [];
parseXML.parseString(csprojContents, (err, parsedCsprojContents) => {
if (err) {
throw new errors_1.FileNotProcessableError(err);
}
const parsedTargetFrameworks = parsedCsprojContents?.Project?.PropertyGroup?.reduce((targetFrameworks, propertyGroup) => {
const targetFrameworkSource = propertyGroup?.TargetFrameworkVersion?.[0] ||
propertyGroup?.TargetFramework?.[0] ||
propertyGroup?.TargetFrameworks?.[0] ||
'';
return targetFrameworks
.concat(targetFrameworkSource.split(';'))
try {
parseXML.parseString(csprojContents, (err, parsedCsprojContents) => {
if (err) {
throw new errors_1.FileNotProcessableError(err);
}
const parsedTargetFrameworks = parsedCsprojContents?.Project?.PropertyGroup?.reduce((targetFrameworks, propertyGroup) => {
const targetFrameworkSource = propertyGroup?.TargetFrameworkVersion?.[0] ||
propertyGroup?.TargetFramework?.[0] ||
propertyGroup?.TargetFrameworks?.[0] ||
'';
return targetFrameworks
.concat(targetFrameworkSource.split(';'))
.filter(Boolean);
}, []) || [];
if (parsedTargetFrameworks.length < 1) {
debug('Could not find TargetFrameworkVersion/TargetFramework' +
'/TargetFrameworks defined in the Project.PropertyGroup field of ' +
'your .csproj file');
result = [];
return;
}
const targetFrameworks = parsedTargetFrameworks
.map(framework_1.toReadableFramework)
.filter(Boolean);
}, []) || [];
if (parsedTargetFrameworks.length < 1) {
debug('Could not find TargetFrameworkVersion/TargetFramework' +
'/TargetFrameworks defined in the Project.PropertyGroup field of ' +
'your .csproj file');
result = [];
if (parsedTargetFrameworks.length > 1 && targetFrameworks.length < 1) {
debug('Could not find valid/supported .NET version in csproj file located at' +
csprojPath);
}
result = targetFrameworks;
return;
}
const targetFrameworks = parsedTargetFrameworks
.map(framework_1.toReadableFramework)
.filter(Boolean);
if (parsedTargetFrameworks.length > 1 && targetFrameworks.length < 1) {
debug('Could not find valid/supported .NET version in csproj file located at' +
csprojPath);
}
result = targetFrameworks;
return;
});
});
}
catch (err) {
throw new errors_1.FileNotProcessableError(`Could not parse ${csprojPath}`);
}
return result;
}
//# sourceMappingURL=csproj-parser.js.map

@@ -62,3 +62,3 @@ {

},
"version": "2.7.13"
"version": "2.7.14"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc