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

Always pass the auth token when listing all gists #322

Merged
merged 1 commit into from
Jul 30, 2020

Conversation

lucasrangit
Copy link
Contributor

Always pass the authentication token when listing gists. It is needed even when listing public gists on GHE. Moreover, bin/gist enforces the presence of the auth token* .

Here's the output without the auth token (bypassed check in bin/gist).

$ gist -l username
Traceback (most recent call last):
	7: from /usr/local/bin/gist:23:in `<main>'
	6: from /usr/local/bin/gist:23:in `load'
	5: from /var/lib/gems/2.5.0/gems/gist-5.1.0/bin/gist:167:in `<top (required)>'
	4: from /var/lib/gems/2.5.0/gems/gist-5.1.0/lib/gist.rb:213:in `list_all_gists'
	3: from /var/lib/gems/2.5.0/gems/gist-5.1.0/lib/gist.rb:269:in `get_gist_pages'
	2: from /var/lib/gems/2.5.0/gems/gist-5.1.0/lib/gist.rb:287:in `pretty_gist'
	1: from /usr/lib/ruby/2.5.0/json/common.rb:156:in `parse'
/usr/lib/ruby/2.5.0/json/common.rb:156:in `parse': 765: unexpected token at '' (JSON::ParserError)

This change was tested on GitHub and GitHub Enterprise.

  • @ConradIrwin let me know if this if true and I will follow up with a cleanup PR that removes the other extraneous checks in other functions. I suspect this may not be true if you want to support anonymous listing of public gists (without login). But that currently doesn't appear to be supported after 09813a3 .

@ConradIrwin ConradIrwin merged commit 1cb2b65 into defunkt:master Jul 30, 2020
@ConradIrwin
Copy link
Collaborator

@lucasrangit thanks for this, I'd love a pull request that cleans up the rest :).

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.

2 participants