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

Fix non-http prepended urls #35

Merged
merged 4 commits into from
Feb 23, 2017
Merged

Conversation

alexjoverm
Copy link
Contributor

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.

Copy link
Collaborator

@kentcdodds kentcdodds left a 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
Copy link
Collaborator

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.

return {
login: body.login,
name: body.name || username,
avatar_url: body.avatar_url,
profile: body.blog || body.html_url
profile: profile
Copy link
Collaborator

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 => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@alexjoverm
Copy link
Contributor Author

@kentcdodds I've also realized I could use startsWith instead of indexOf :)

@kentcdodds kentcdodds merged commit a879de2 into all-contributors:master Feb 23, 2017
@kentcdodds
Copy link
Collaborator

Thanks a bunch!

@jfmengels
Copy link
Collaborator

Thanks a lot @alexjoverm! 🎉

Berkmann18 pushed a commit that referenced this pull request May 24, 2020
* docs: update README.md

* docs: update .all-contributorsrc
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.

3 participants