Skip to content

Commit

Permalink
cmd/faucet: improve handling of facebook post url (ethereum#21838)
Browse files Browse the repository at this point in the history
Resolves ethereum#21532

Co-authored-by: roger <[email protected]>
  • Loading branch information
LieutenantRoger and roger authored Nov 24, 2020
1 parent ead8146 commit 6b58409
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/faucet/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,10 @@ func authTwitter(url string) (string, string, common.Address, error) {
// returning the username, avatar URL and Ethereum address to fund on success.
func authFacebook(url string) (string, string, common.Address, error) {
// Ensure the user specified a meaningful URL, no fancy nonsense
parts := strings.Split(url, "/")
parts := strings.Split(strings.Split(url, "?")[0], "/")
if parts[len(parts)-1] == "" {
parts = parts[0 : len(parts)-1]
}
if len(parts) < 4 || parts[len(parts)-2] != "posts" {
//lint:ignore ST1005 This error is to be displayed in the browser
return "", "", common.Address{}, errors.New("Invalid Facebook post URL")
Expand Down

0 comments on commit 6b58409

Please sign in to comment.