Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed output filename to remove : character #6

Merged
merged 3 commits into from
Dec 14, 2021
Merged

Changed output filename to remove : character #6

merged 3 commits into from
Dec 14, 2021

Conversation

karl-barbour
Copy link
Contributor

Fixes #5

@CLAassistant
Copy link

CLAassistant commented Dec 14, 2021

CLA assistant check
All committers have signed the CLA.

@karl-barbour karl-barbour changed the title Changed output filename to remove character Changed output filename to remove : character Dec 14, 2021
Copy link
Contributor

@fightingmonk fightingmonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick PR to fix this!

I tested a few environments and found that replaceAll() isn't supported on my version of node v12 or v14. I suggest using .replace(/:/g, '-') instead.

nr-find-log4j.js Outdated
@@ -429,7 +429,7 @@ function writeResults(state) {
state.scanDurationSec = Math.ceil((state.scanCompleted - state.scanStarted) / 1000);

process.stdout.write(`\nOK, scan took ${state.scanDurationSec} seconds. Found ${vulnerableApplications.length} services with log4j-core.\n`);
const fileTimestamp = (new Date()).toISOString();
const fileTimestamp = new Date().toISOString().replaceAll(":","_");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string.replaceAll() isn't supported in the Node v12 and v14 versions I tested with. we could use the regex global version of replace instead: .replace(//g, '')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely correct, apologies @fightingmonk - I had upgraded to 16 to see if it fixed the initial issue and didn't test backwards compatibility. New change suggested.

Copy link
Contributor

@fightingmonk fightingmonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perfect, thanks for the fix!

@fightingmonk fightingmonk merged commit 0d8cfa2 into newrelic-experimental:main Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File cannot be created on Windows due to ":" in filename
3 participants