summaryrefslogtreecommitdiff
path: root/internal/media/refetch.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/media/refetch.go')
-rw-r--r--internal/media/refetch.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/media/refetch.go b/internal/media/refetch.go
index d02f14872..e5b91d56f 100644
--- a/internal/media/refetch.go
+++ b/internal/media/refetch.go
@@ -24,12 +24,13 @@ import (
"io"
"net/url"
+ "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/log"
)
-type DereferenceMedia func(ctx context.Context, iri *url.URL) (io.ReadCloser, int64, error)
+type DereferenceMedia func(ctx context.Context, iri *url.URL, maxsz int64) (io.ReadCloser, error)
// RefetchEmojis iterates through remote emojis (for the given domain, or all if domain is empty string).
//
@@ -48,6 +49,9 @@ func (m *Manager) RefetchEmojis(ctx context.Context, domain string, dereferenceM
refetchIDs []string
)
+ // Get max supported remote emoji media size.
+ maxsz := config.GetMediaEmojiRemoteMaxSize()
+
// page through emojis 20 at a time, looking for those with missing images
for {
// Fetch next block of emojis from database
@@ -107,8 +111,8 @@ func (m *Manager) RefetchEmojis(ctx context.Context, domain string, dereferenceM
continue
}
- dataFunc := func(ctx context.Context) (reader io.ReadCloser, fileSize int64, err error) {
- return dereferenceMedia(ctx, emojiImageIRI)
+ dataFunc := func(ctx context.Context) (reader io.ReadCloser, err error) {
+ return dereferenceMedia(ctx, emojiImageIRI, int64(maxsz))
}
processingEmoji, err := m.RefreshEmoji(ctx, emoji, dataFunc, AdditionalEmojiInfo{