-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Hash username to avoid invalid file paths #31
Conversation
const exclusions = ['--help']; | ||
|
||
const hash = crypto.createHash('md5'); | ||
hash.update(user); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was pretty sure this was how md5 hashes were done in node, but I just tried it and it didn't work. Can you please add a test for this also? Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to be due to encoding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you string together the calls, e.g. crypto.createHash('md5').update(user, encoding).digest(encoding)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@phated, what version are you using? The default encoding works fine for me on Node 5.10.1.
Fixed the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the old tests still work because they depend on the configfile
exported by this file.
@phated does this look good to merge? |
@ilikebits can you add a test where |
Could you please complete this PR? Ran into this issue again today and this would fix it perfectly. Instead I had to run a custom script with code I grabbed from this lib to manually make the directory in case username had a / in it. |
@tkellen are we good to merge this? |
I'm gunshy given how many issues we've had with this project, but yes, I think we are. |
@tkellen me too, but I figured I'd be around my computer today and could field all the backlash 😛 |
Published as 2.1.0 (seems like a feature and to give more wiggle room in semver). |
@tkellen gunshy not in vain, but I have it fixed with only a really weird, rare edge case that might encounter issues (multiple accounts without USER env that end up with the same json config but not matching). |
Ha! Thank you for taking the brunt of this @phated |
This resolves follow-up issues on #22 where some usernames create invalid file paths for the cache file.