diff options
author | 2022-01-23 14:41:58 +0100 | |
---|---|---|
committer | 2022-01-23 14:41:58 +0100 | |
commit | c157b1b20b38cc331cfd1673433d077719feef3f (patch) | |
tree | 69777c5d300ed87d0ac8bb0daf51d8ffa4c4ddb7 /internal/processing/account/update.go | |
parent | use exif-terminator (diff) | |
download | gotosocial-c157b1b20b38cc331cfd1673433d077719feef3f.tar.xz |
rework data function to provide filesize
Diffstat (limited to 'internal/processing/account/update.go')
-rw-r--r-- | internal/processing/account/update.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/internal/processing/account/update.go b/internal/processing/account/update.go index 5a0a3e5a1..758cc6600 100644 --- a/internal/processing/account/update.go +++ b/internal/processing/account/update.go @@ -140,8 +140,9 @@ func (p *processor) UpdateAvatar(ctx context.Context, avatar *multipart.FileHead return nil, fmt.Errorf("UpdateAvatar: avatar with size %d exceeded max image size of %d bytes", avatar.Size, maxImageSize) } - dataFunc := func(ctx context.Context) (io.Reader, error) { - return avatar.Open() + dataFunc := func(ctx context.Context) (io.Reader, int, error) { + f, err := avatar.Open() + return f, int(avatar.Size), err } isAvatar := true @@ -166,8 +167,9 @@ func (p *processor) UpdateHeader(ctx context.Context, header *multipart.FileHead return nil, fmt.Errorf("UpdateHeader: header with size %d exceeded max image size of %d bytes", header.Size, maxImageSize) } - dataFunc := func(ctx context.Context) (io.Reader, error) { - return header.Open() + dataFunc := func(ctx context.Context) (io.Reader, int, error) { + f, err := header.Open() + return f, int(header.Size), err } isHeader := true |