mirror of
1
Fork 0

[bugfix] Only search remote if protocol is http(s) (#601)

This commit is contained in:
tobi 2022-05-24 13:38:11 +02:00 committed by GitHub
parent 21557c92d9
commit 2d748a68ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -65,9 +65,9 @@ func (p *processor) SearchGet(ctx context.Context, authed *oauth.Auth, searchQue
} }
} }
// check if the query is a URI and just do a lookup for that, straight up // check if the query is a URI with a recognizable scheme and just do a lookup for that, straight up
if !foundOne { if !foundOne {
if uri, err := url.Parse(query); err == nil { if uri, err := url.Parse(query); err == nil && (uri.Scheme == "https" || uri.Scheme == "http") {
// 1. check if it's a status // 1. check if it's a status
if foundStatus, err := p.searchStatusByURI(ctx, authed, uri, searchQuery.Resolve); err == nil && foundStatus != nil { if foundStatus, err := p.searchStatusByURI(ctx, authed, uri, searchQuery.Resolve); err == nil && foundStatus != nil {
foundStatuses = append(foundStatuses, foundStatus) foundStatuses = append(foundStatuses, foundStatus)
@ -201,9 +201,11 @@ func (p *processor) searchAccountByMention(ctx context.Context, authed *oauth.Au
return nil, fmt.Errorf("error fingering remote account with username %s and domain %s: %s", username, domain, err) return nil, fmt.Errorf("error fingering remote account with username %s and domain %s: %s", username, domain, err)
} }
if acctURI.Scheme == "https" || acctURI.Scheme == "http" {
// return the attempt to get the remove account // return the attempt to get the remove account
return p.federator.GetRemoteAccount(ctx, authed.Account.Username, acctURI, true, true) return p.federator.GetRemoteAccount(ctx, authed.Account.Username, acctURI, true, true)
} }
}
return nil, nil return nil, nil
} }