summaryrefslogtreecommitdiff
path: root/internal/media/handler.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-08-29 12:03:08 +0200
committerLibravatar GitHub <noreply@github.com>2021-08-29 12:03:08 +0200
commit53507ac2a32a785b5467b1e58d033780d8e02693 (patch)
tree1c48ac9f5fc47e65450d53d8d26d0dee30753687 /internal/media/handler.go
parentReplace federating DB locks map, add a cleanup goroutine (#166) (diff)
downloadgotosocial-53507ac2a32a785b5467b1e58d033780d8e02693.tar.xz
Mention fixup (#167)
* rework mention creation a bit * rework mention creation a bit * tidy up status dereferencing * start adding tests for dereferencing * fixups * fix * review changes
Diffstat (limited to 'internal/media/handler.go')
-rw-r--r--internal/media/handler.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/internal/media/handler.go b/internal/media/handler.go
index 1150f7e87..b467100b0 100644
--- a/internal/media/handler.go
+++ b/internal/media/handler.go
@@ -80,13 +80,6 @@ type Handler interface {
// in the database.
ProcessLocalEmoji(ctx context.Context, emojiBytes []byte, shortcode string) (*gtsmodel.Emoji, error)
- // ProcessRemoteAttachment takes a transport, a bare-bones current attachment, and an accountID that the attachment belongs to.
- // It then dereferences the attachment (ie., fetches the attachment bytes from the remote server), ensuring that the bytes are
- // the correct content type. It stores the attachment in whatever storage backend the Handler has been initalized with, and returns
- // information to the caller about the new attachment. It's the caller's responsibility to put the returned struct
- // in the database.
- ProcessRemoteAttachment(ctx context.Context, t transport.Transport, currentAttachment *gtsmodel.MediaAttachment, accountID string) (*gtsmodel.MediaAttachment, error)
-
ProcessRemoteHeaderOrAvatar(ctx context.Context, t transport.Transport, currentAttachment *gtsmodel.MediaAttachment, accountID string) (*gtsmodel.MediaAttachment, error)
}
@@ -296,30 +289,6 @@ func (mh *mediaHandler) ProcessLocalEmoji(ctx context.Context, emojiBytes []byte
return e, nil
}
-func (mh *mediaHandler) ProcessRemoteAttachment(ctx context.Context, t transport.Transport, currentAttachment *gtsmodel.MediaAttachment, accountID string) (*gtsmodel.MediaAttachment, error) {
- if currentAttachment.RemoteURL == "" {
- return nil, errors.New("no remote URL on media attachment to dereference")
- }
- remoteIRI, err := url.Parse(currentAttachment.RemoteURL)
- if err != nil {
- return nil, fmt.Errorf("error parsing attachment url %s: %s", currentAttachment.RemoteURL, err)
- }
-
- // for content type, we assume we don't know what to expect...
- expectedContentType := "*/*"
- if currentAttachment.File.ContentType != "" {
- // ... and then narrow it down if we do
- expectedContentType = currentAttachment.File.ContentType
- }
-
- attachmentBytes, err := t.DereferenceMedia(context.Background(), remoteIRI, expectedContentType)
- if err != nil {
- return nil, fmt.Errorf("dereferencing remote media with url %s: %s", remoteIRI.String(), err)
- }
-
- return mh.ProcessAttachment(ctx, attachmentBytes, accountID, currentAttachment.RemoteURL)
-}
-
func (mh *mediaHandler) ProcessRemoteHeaderOrAvatar(ctx context.Context, t transport.Transport, currentAttachment *gtsmodel.MediaAttachment, accountID string) (*gtsmodel.MediaAttachment, error) {
if !currentAttachment.Header && !currentAttachment.Avatar {