diff options
author | 2025-02-11 13:16:14 +0100 | |
---|---|---|
committer | 2025-02-11 13:16:14 +0100 | |
commit | d0de3ad49260ad2f87d02ce1307b1f20e88a1fdf (patch) | |
tree | a4eab190784a8d456226788404a71f263ecbdc49 /internal/federation/dereferencing/instance.go | |
parent | [bugfix] Suggest lowercase username when creating via OIDC (#3780) (diff) | |
download | gotosocial-d0de3ad49260ad2f87d02ce1307b1f20e88a1fdf.tar.xz |
[bug] respect `X-Robots-Tag` and `robots.txt` on api/v1/instance and nodeinfo (#3756)
* feat: check X-Robots-Tag
when accessing /api/v1/instance or /nodeinfo endpoints respect
X-Robots-Tag
* chore: go fmt ./...
* Check robots.txt as well, add tests
---------
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/federation/dereferencing/instance.go')
-rw-r--r-- | internal/federation/dereferencing/instance.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/federation/dereferencing/instance.go b/internal/federation/dereferencing/instance.go index 90ce074cd..66d0a21be 100644 --- a/internal/federation/dereferencing/instance.go +++ b/internal/federation/dereferencing/instance.go @@ -19,20 +19,20 @@ package dereferencing import ( "context" - "fmt" "net/url" + "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" ) func (d *Dereferencer) GetRemoteInstance(ctx context.Context, username string, remoteInstanceURI *url.URL) (*gtsmodel.Instance, error) { if blocked, err := d.state.DB.IsDomainBlocked(ctx, remoteInstanceURI.Host); blocked || err != nil { - return nil, fmt.Errorf("GetRemoteInstance: domain %s is blocked", remoteInstanceURI.Host) + return nil, gtserror.Newf("domain %s is blocked", remoteInstanceURI.Host) } transport, err := d.transportController.NewTransportForUsername(ctx, username) if err != nil { - return nil, fmt.Errorf("transport err: %s", err) + return nil, gtserror.Newf("transport err: %w", err) } return transport.DereferenceInstance(ctx, remoteInstanceURI) |