From c54510bc7407f22b58bd56ad65b2e3f60e8e4dc5 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Thu, 6 Apr 2023 13:19:55 +0200 Subject: [bugfix] Normalize status content (don't parse status content as IRI) (#1665) * start fannying about * finish up Normalize * tidy up * pin to tag * move errors about just a little bit --- internal/processing/search.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'internal/processing/search.go') diff --git a/internal/processing/search.go b/internal/processing/search.go index 9aa89a17b..0c9ef43fd 100644 --- a/internal/processing/search.go +++ b/internal/processing/search.go @@ -25,6 +25,7 @@ import ( "strings" "codeberg.org/gruf/go-kv" + "github.com/superseriousbusiness/gotosocial/internal/ap" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" @@ -131,9 +132,10 @@ func (p *Processor) SearchGet(ctx context.Context, authed *oauth.Auth, search *a // check if it's a status... foundStatus, err := p.searchStatusByURI(ctx, authed, uri) if err != nil { + // Check for semi-expected error types. var ( errNotRetrievable *dereferencing.ErrNotRetrievable - errWrongType *dereferencing.ErrWrongType + errWrongType *ap.ErrWrongType ) if !errors.As(err, &errNotRetrievable) && !errors.As(err, &errWrongType) { return nil, gtserror.NewErrorInternalError(fmt.Errorf("error looking up status: %w", err)) @@ -148,9 +150,10 @@ func (p *Processor) SearchGet(ctx context.Context, authed *oauth.Auth, search *a if !foundOne { foundAccount, err := p.searchAccountByURI(ctx, authed, uri, search.Resolve) if err != nil { + // Check for semi-expected error types. var ( errNotRetrievable *dereferencing.ErrNotRetrievable - errWrongType *dereferencing.ErrWrongType + errWrongType *ap.ErrWrongType ) if !errors.As(err, &errNotRetrievable) && !errors.As(err, &errWrongType) { return nil, gtserror.NewErrorInternalError(fmt.Errorf("error looking up account: %w", err)) -- cgit v1.2.3