From 27f465913916505197b06503efd7c30a79ac2016 Mon Sep 17 00:00:00 2001 From: KEINOS Date: Wed, 25 Oct 2023 21:58:45 +0900 Subject: [bugfix] allow store smaller PNG image than 261 bytes (#2263) (#2298) * chore: add test of golden cases before fix of #2263 * chore: add test case to reproduce error of #2263 * [bugfix] allow store smaller PNG image than 261 bytes (#2263) --- internal/media/processingmedia.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/media/processingmedia.go') diff --git a/internal/media/processingmedia.go b/internal/media/processingmedia.go index acfee48f3..591cbac74 100644 --- a/internal/media/processingmedia.go +++ b/internal/media/processingmedia.go @@ -161,8 +161,8 @@ func (p *ProcessingMedia) store(ctx context.Context) error { // and https://github.com/h2non/filetype hdrBuf := make([]byte, 261) - // Read the first 261 header bytes into buffer. - if _, err := io.ReadFull(rc, hdrBuf); err != nil { + // Read the first 261 header bytes into buffer as much as possible. + if _, err := rc.Read(hdrBuf); err != nil { return gtserror.Newf("error reading incoming media: %w", err) } -- cgit v1.2.3