Skip to content

Commit

Permalink
replacing invalid chars with underscores in env (yarnpkg#3687)
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoarslan authored and arcanis committed Jun 22, 2017
1 parent b0a4758 commit 23dd84b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util/execute-lifecycle-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export async function makeEnv(
if (cleanVal.indexOf('\n') >= 0) {
cleanVal = JSON.stringify(cleanVal);
}
env[`npm_package_${key}`] = cleanVal;

//replacing invalid chars with underscore
const cleanKey = key.replace(/[^a-zA-Z0-9_]/g, '_');

env[`npm_package_${cleanKey}`] = cleanVal;
}
}
}
Expand Down

0 comments on commit 23dd84b

Please sign in to comment.