mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-11-28 11:21:00 +00:00
[bugfix] Account self finger fix (#658)
* check only 1 of status/account when search by uri * don't try to resolve local uris when searching
This commit is contained in:
parent
ec81d28a77
commit
8c7945fb78
1 changed files with 9 additions and 6 deletions
|
@ -85,14 +85,17 @@ func (p *processor) SearchGet(ctx context.Context, authed *oauth.Auth, search *a
|
||||||
*/
|
*/
|
||||||
if !foundOne {
|
if !foundOne {
|
||||||
if uri, err := url.Parse(query); err == nil && (uri.Scheme == "https" || uri.Scheme == "http") {
|
if uri, err := url.Parse(query); err == nil && (uri.Scheme == "https" || uri.Scheme == "http") {
|
||||||
// 1. check if it's a status
|
// don't attempt to resolve (ie., dereference) local accounts/statuses
|
||||||
if foundStatus, err := p.searchStatusByURI(ctx, authed, uri, search.Resolve); err == nil && foundStatus != nil {
|
resolve := search.Resolve
|
||||||
foundStatuses = append(foundStatuses, foundStatus)
|
if uri.Host == config.GetHost() || uri.Host == config.GetAccountDomain() {
|
||||||
l.Debug("got a status by searching by URI")
|
resolve = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. check if it's an account
|
// check if it's a status or an account
|
||||||
if foundAccount, err := p.searchAccountByURI(ctx, authed, uri, search.Resolve); err == nil && foundAccount != nil {
|
if foundStatus, err := p.searchStatusByURI(ctx, authed, uri, resolve); err == nil && foundStatus != nil {
|
||||||
|
foundStatuses = append(foundStatuses, foundStatus)
|
||||||
|
l.Debug("got a status by searching by URI")
|
||||||
|
} else if foundAccount, err := p.searchAccountByURI(ctx, authed, uri, resolve); err == nil && foundAccount != nil {
|
||||||
foundAccounts = append(foundAccounts, foundAccount)
|
foundAccounts = append(foundAccounts, foundAccount)
|
||||||
l.Debug("got an account by searching by URI")
|
l.Debug("got an account by searching by URI")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue