Skip to content

Commit 6b58409

Browse files
LieutenantRogerroger
andauthored
cmd/faucet: improve handling of facebook post url (#21838)
Resolves #21532 Co-authored-by: roger <dengjun@huobi.com>
1 parent ead8146 commit 6b58409

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎cmd/faucet/faucet.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,10 @@ func authTwitter(url string) (string, string, common.Address, error) {
732732
// returning the username, avatar URL and Ethereum address to fund on success.
733733
func authFacebook(url string) (string, string, common.Address, error) {
734734
// Ensure the user specified a meaningful URL, no fancy nonsense
735-
parts := strings.Split(url, "/")
735+
parts := strings.Split(strings.Split(url, "?")[0], "/")
736+
if parts[len(parts)-1] == "" {
737+
parts = parts[0 : len(parts)-1]
738+
}
736739
if len(parts) < 4 || parts[len(parts)-2] != "posts" {
737740
//lint:ignore ST1005 This error is to be displayed in the browser
738741
return "", "", common.Address{}, errors.New("Invalid Facebook post URL")

0 commit comments

Comments
 (0)