Skip to content

Commit

Permalink
fix: patch filename compat with windows
Browse files Browse the repository at this point in the history
Fixes #22

TL,DR; use dash instead of colons.
  • Loading branch information
smockle authored and remy committed Jul 7, 2016
1 parent bbc9bbd commit a484a1f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/protect/write-patch-flag.js
Expand Up @@ -13,13 +13,16 @@ function writePatchFlag(now, vuln) {

debug('writing flag for %s', vuln.id);
var promise;
var flag = path.resolve(vuln.source, '.snyk-' + vuln.id + '.flag');
// the colon doesn't like Windows, ref: https://git.io/vw2iO
var fileSafeId = vuln.id.replace(/:/g, '-');
var flag = path.resolve(vuln.source, '.snyk-' + fileSafeId + '.flag');
if (vuln.grouped && vuln.grouped.includes) {
debug('found addition vulns to write flag files for');
var writePromises = [fs.writeFile(flag, now.toJSON(), 'utf8')];
debug(flag);
vuln.grouped.includes.forEach(function (id) {
var flag = path.resolve(vuln.source, '.snyk-' + id + '.flag');
var fileSafeId = vuln.id.replace(/:/g, '-');
var flag = path.resolve(vuln.source, '.snyk-' + fileSafeId + '.flag');
debug(flag);
writePromises.push(fs.writeFile(flag, now.toJSON(), 'utf8'));
});
Expand All @@ -31,4 +34,4 @@ function writePatchFlag(now, vuln) {
return promise.then(function () {
return vuln;
});
}
}

0 comments on commit a484a1f

Please sign in to comment.