summaryrefslogtreecommitdiff
path: root/internal/media/processingmedia.go
diff options
context:
space:
mode:
authorLibravatar KEINOS <github@keinos.com>2023-10-25 21:58:45 +0900
committerLibravatar GitHub <noreply@github.com>2023-10-25 14:58:45 +0200
commit27f465913916505197b06503efd7c30a79ac2016 (patch)
tree9aed4c711f85bdc99e5aae077d76e8debbe560ca /internal/media/processingmedia.go
parent[bugfix/frontend] Export/import CSV correctly (#2294) (diff)
downloadgotosocial-27f465913916505197b06503efd7c30a79ac2016.tar.xz
[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)
Diffstat (limited to 'internal/media/processingmedia.go')
-rw-r--r--internal/media/processingmedia.go4
1 files changed, 2 insertions, 2 deletions
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)
}