summaryrefslogtreecommitdiff
path: root/internal/media
diff options
context:
space:
mode:
Diffstat (limited to 'internal/media')
-rw-r--r--internal/media/handler.go22
-rw-r--r--internal/media/processicon.go4
-rw-r--r--internal/media/processimage.go4
3 files changed, 15 insertions, 15 deletions
diff --git a/internal/media/handler.go b/internal/media/handler.go
index f2450bbc0..058337ecf 100644
--- a/internal/media/handler.go
+++ b/internal/media/handler.go
@@ -84,19 +84,19 @@ type Handler interface {
}
type mediaHandler struct {
- config *config.Config
- db db.DB
- store *kv.KVStore
- log *logrus.Logger
+ config *config.Config
+ db db.DB
+ storage *kv.KVStore
+ log *logrus.Logger
}
// New returns a new handler with the given config, db, storage, and logger
-func New(config *config.Config, database db.DB, store *kv.KVStore, log *logrus.Logger) Handler {
+func New(config *config.Config, database db.DB, storage *kv.KVStore, log *logrus.Logger) Handler {
return &mediaHandler{
- config: config,
- db: database,
- store: store,
- log: log,
+ config: config,
+ db: database,
+ storage: storage,
+ log: log,
}
}
@@ -257,12 +257,12 @@ func (mh *mediaHandler) ProcessLocalEmoji(ctx context.Context, emojiBytes []byte
emojiStaticPath := fmt.Sprintf("%s/%s/%s/%s/%s.png", mh.config.StorageConfig.BasePath, instanceAccount.ID, Emoji, Static, newEmojiID)
// Store the original emoji
- if err := mh.store.Put(emojiPath, original.image); err != nil {
+ if err := mh.storage.Put(emojiPath, original.image); err != nil {
return nil, fmt.Errorf("storage error: %s", err)
}
// Store the static emoji
- if err := mh.store.Put(emojiStaticPath, static.image); err != nil {
+ if err := mh.storage.Put(emojiStaticPath, static.image); err != nil {
return nil, fmt.Errorf("storage error: %s", err)
}
diff --git a/internal/media/processicon.go b/internal/media/processicon.go
index 9ef4d77ec..b6b113b0c 100644
--- a/internal/media/processicon.go
+++ b/internal/media/processicon.go
@@ -85,13 +85,13 @@ func (mh *mediaHandler) processHeaderOrAvi(imageBytes []byte, contentType string
// we store the original...
originalPath := fmt.Sprintf("%s/%s/%s/%s/%s.%s", mh.config.StorageConfig.BasePath, accountID, mediaType, Original, newMediaID, extension)
- if err := mh.store.Put(originalPath, original.image); err != nil {
+ if err := mh.storage.Put(originalPath, original.image); err != nil {
return nil, fmt.Errorf("storage error: %s", err)
}
// and a thumbnail...
smallPath := fmt.Sprintf("%s/%s/%s/%s/%s.%s", mh.config.StorageConfig.BasePath, accountID, mediaType, Small, newMediaID, extension)
- if err := mh.store.Put(smallPath, small.image); err != nil {
+ if err := mh.storage.Put(smallPath, small.image); err != nil {
return nil, fmt.Errorf("storage error: %s", err)
}
diff --git a/internal/media/processimage.go b/internal/media/processimage.go
index 3e7e60fb7..e06ad8d14 100644
--- a/internal/media/processimage.go
+++ b/internal/media/processimage.go
@@ -73,13 +73,13 @@ func (mh *mediaHandler) processImageAttachment(data []byte, minAttachment *gtsmo
// we store the original...
originalPath := fmt.Sprintf("%s/%s/%s/%s/%s.%s", mh.config.StorageConfig.BasePath, minAttachment.AccountID, Attachment, Original, newMediaID, extension)
- if err := mh.store.Put(originalPath, original.image); err != nil {
+ if err := mh.storage.Put(originalPath, original.image); err != nil {
return nil, fmt.Errorf("storage error: %s", err)
}
// and a thumbnail...
smallPath := fmt.Sprintf("%s/%s/%s/%s/%s.jpeg", mh.config.StorageConfig.BasePath, minAttachment.AccountID, Attachment, Small, newMediaID) // all thumbnails/smalls are encoded as jpeg
- if err := mh.store.Put(smallPath, small.image); err != nil {
+ if err := mh.storage.Put(smallPath, small.image); err != nil {
return nil, fmt.Errorf("storage error: %s", err)
}