Files
warmbly/internal/app/worker/wmail/storage_body.go
T
Matthew Meszaros 59b515cad4 callers: migrate blob access from raw *s3 inputs to storage.Store
Seven call sites stop reaching through the embedded *s3.Client and
instead use the high-level storage.Store methods. Same runtime behavior
on the AWS path; opens the door to the Filesystem backend for
self-hosters.

avatar.go retains an S3-specific path for public-ACL + cache-control
on uploaded avatars and falls back to ServiceUnavailable on non-S3
backends. A future PublicStore interface could clean that up.

unibox/storage.go GetBody now propagates the emsg.DecodeBinary error
that the original code dropped on the floor.
2026-05-27 14:41:53 +00:00

27 lines
664 B
Go

package wmail
import (
"bytes"
"context"
"github.com/google/uuid"
"github.com/warmbly/warmbly/internal/config"
"github.com/warmbly/warmbly/internal/pkg/emsg"
)
func (c *WMail) Exists(ctx context.Context, messageID uuid.UUID) (bool, error) {
key := config.StorageEndpointEmailBody(c.UserID, c.ID, messageID)
return c.Storage.Has(ctx, key)
}
func (c *WMail) StoreBody(ctx context.Context, emailMessageID uuid.UUID, data *emsg.EmailBlob) error {
bytedata, err := data.EncodeBinary()
if err != nil {
return err
}
key := config.StorageEndpointEmailBody(c.UserID, c.ID, emailMessageID)
return c.Storage.Put(ctx, key, bytes.NewReader(bytedata), "")
}