summaryrefslogtreecommitdiff
path: root/internal/media/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/media/util.go')
-rw-r--r--internal/media/util.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/media/util.go b/internal/media/util.go
index 22121a546..538d6f572 100644
--- a/internal/media/util.go
+++ b/internal/media/util.go
@@ -29,6 +29,7 @@ import (
"codeberg.org/gruf/go-bytesize"
"codeberg.org/gruf/go-iotools"
"codeberg.org/gruf/go-mimetypes"
+ "github.com/superseriousbusiness/gotosocial/internal/gtserror"
)
// file represents one file
@@ -143,8 +144,9 @@ func drainToTmp(rc io.ReadCloser) (string, error) {
// Check to see if limit was reached,
// (produces more useful error messages).
- if lr != nil && !iotools.AtEOF(lr.R) {
- return path, fmt.Errorf("reached read limit %s", bytesize.Size(limit))
+ if lr != nil && lr.N <= 0 {
+ err := fmt.Errorf("reached read limit %s", bytesize.Size(limit))
+ return path, gtserror.SetLimitReached(err)
}
return path, nil