summaryrefslogtreecommitdiff
path: root/internal/federation
diff options
context:
space:
mode:
Diffstat (limited to 'internal/federation')
-rw-r--r--internal/federation/dereferencing/attachment.go4
-rw-r--r--internal/federation/federatingdb/create.go3
2 files changed, 5 insertions, 2 deletions
diff --git a/internal/federation/dereferencing/attachment.go b/internal/federation/dereferencing/attachment.go
index 0c7005e23..36ff2734c 100644
--- a/internal/federation/dereferencing/attachment.go
+++ b/internal/federation/dereferencing/attachment.go
@@ -20,6 +20,7 @@ package dereferencing
import (
"context"
+ "errors"
"fmt"
"net/url"
@@ -60,7 +61,8 @@ func (d *deref) GetRemoteAttachment(ctx context.Context, requestingUsername stri
}
if err := d.db.Put(ctx, a); err != nil {
- if err != db.ErrAlreadyExists {
+ var alreadyExistsError *db.ErrAlreadyExists
+ if !errors.As(err, &alreadyExistsError) {
return nil, fmt.Errorf("GetRemoteAttachment: error inserting attachment: %s", err)
}
}
diff --git a/internal/federation/federatingdb/create.go b/internal/federation/federatingdb/create.go
index b07f4f04f..6c86151f3 100644
--- a/internal/federation/federatingdb/create.go
+++ b/internal/federation/federatingdb/create.go
@@ -231,7 +231,8 @@ func (f *federatingDB) createNote(ctx context.Context, note vocab.ActivityStream
status.ID = statusID
if err := f.db.PutStatus(ctx, status); err != nil {
- if err == db.ErrAlreadyExists {
+ var alreadyExistsError *db.ErrAlreadyExists
+ if errors.As(err, &alreadyExistsError) {
// the status already exists in the database, which means we've already handled everything else,
// so we can just return nil here and be done with it.
return nil