summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-06-20 14:11:36 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-20 14:11:36 +0200
commit8c7945fb7872b63aa7cc3179023aba75b1fcffe5 (patch)
tree60ac6ed0b70b8c67b9144e717cf403fb96916878
parent[frontend] add Accept header to oauthed api requests (#657) (diff)
downloadgotosocial-8c7945fb7872b63aa7cc3179023aba75b1fcffe5.tar.xz
[bugfix] Account self finger fix (#658)v0.3.6
* check only 1 of status/account when search by uri * don't try to resolve local uris when searching
-rw-r--r--internal/processing/search.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/internal/processing/search.go b/internal/processing/search.go
index d4ff94a21..ee64526e5 100644
--- a/internal/processing/search.go
+++ b/internal/processing/search.go
@@ -85,14 +85,17 @@ func (p *processor) SearchGet(ctx context.Context, authed *oauth.Auth, search *a
*/
if !foundOne {
if uri, err := url.Parse(query); err == nil && (uri.Scheme == "https" || uri.Scheme == "http") {
- // 1. check if it's a status
- if foundStatus, err := p.searchStatusByURI(ctx, authed, uri, search.Resolve); err == nil && foundStatus != nil {
- foundStatuses = append(foundStatuses, foundStatus)
- l.Debug("got a status by searching by URI")
+ // don't attempt to resolve (ie., dereference) local accounts/statuses
+ resolve := search.Resolve
+ if uri.Host == config.GetHost() || uri.Host == config.GetAccountDomain() {
+ resolve = false
}
- // 2. check if it's an account
- if foundAccount, err := p.searchAccountByURI(ctx, authed, uri, search.Resolve); err == nil && foundAccount != nil {
+ // check if it's a status or an account
+ 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)
l.Debug("got an account by searching by URI")
}