Skip to content

Commit

Permalink
Remove https://x.com or https://twitter.com prefix from location head…
Browse files Browse the repository at this point in the history
…er. (#184)

Remove https://x.com or https://twitter.com prefix from location header.
  • Loading branch information
ice-myles authored Jul 9, 2024
1 parent 0328e46 commit ad9ab8a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kyc/social/internal/twitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ func (t *twitterVerifierImpl) VerifyPostLinkOf(ctx context.Context, target, expe

if strings.HasPrefix(target, "https://t.co") {
loc, err := t.Scraper.Fetcher().Head(ctx, target)
if strings.HasPrefix(loc, "https://twitter.com") {
loc = strings.Replace(loc, "https://twitter.com", "", 1)
}
if strings.HasPrefix(loc, "https://x.com") {
loc = strings.Replace(loc, "https://x.com", "", 1)
}
if err != nil {
log.Warn("twitter: failed to fetch location header", "error", err)
// Fallthrough.
Expand Down

0 comments on commit ad9ab8a

Please sign in to comment.