-
Notifications
You must be signed in to change notification settings - Fork 146
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
Fix non-http prepended urls #35
Conversation
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.
Cool! Just a few changes. Thanks!
.editorconfig
Outdated
@@ -0,0 +1,16 @@ | |||
#root = true |
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.
Please remove this. I prefer to not have unrelated changes in PRs. Feel free to make another PR if you want to add this.
lib/contributors/github.js
Outdated
return { | ||
login: body.login, | ||
name: body.name || username, | ||
avatar_url: body.avatar_url, | ||
profile: body.blog || body.html_url | ||
profile: profile |
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.
We support Node v4 and above so you can use object shorthand here:
{
// ...
profile
// ...
}
@@ -41,3 +41,19 @@ test('should fill in the name when an empty string is returned', t => { | |||
t.is(info.name, 'nodisplayname'); | |||
}); | |||
}); | |||
|
|||
test('should append http when no absolute link is provided', t => { |
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.
👍
@kentcdodds I've also realized I could use startsWith instead of indexOf :) |
Thanks a bunch! |
Thanks a lot @alexjoverm! 🎉 |
* docs: update README.md * docs: update .all-contributorsrc
When either
body.blog || body.html_url
are not prepended with http, github itself does it for you. But when those are retrieved from the url, they still come without the http://, causing the link to be broken.See this PR from one of my repos for more info: alexjoverm/typescript-library-starter#7
Additionally, I made this PR from windows and was finding a lot of CLRF issues, so I've added a .editorconfig thus that doesn't happen to other people.