Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cristiand391
Copy link
Contributor

Fix #1966

Copy link
Contributor

@ErKiran ErKiran left a comment

Choose a reason for hiding this comment

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

Is it better to use id instead of Login property?

username, err := api.CurrentLoginName(apiClient, ghinstance.OverridableDefault())
	if err != nil {
		return err
	}
	if username != gist.Owner.Login {
		return fmt.Errorf("You do not own this gist.")
	}

Use the id property of the owner and compare it with api.CurrentUserID(apiClient, hostname)

@hmoooda

This comment has been minimized.

@vilmibm vilmibm self-requested a review October 5, 2020 16:01
Copy link
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

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

awesome work, thank you!

@vilmibm vilmibm merged commit 14a5e00 into cli:trunk Oct 5, 2020
@cristiand391 cristiand391 deleted the check-gist-ownership branch October 5, 2020 22:09
Copy link

@Mercadojale Mercadojale left a comment

Choose a reason for hiding this comment

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

Ok

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.

gist: edit command doesn't check gist ownership before editing

6 participants