mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-31 22:02:25 -05:00
[bugfix] Close reader gracefully when streaming recache of remote media to fileserver api caller (#1281)
* close pipereader on failed data function * gently slurp the bytes * readability updates * go fmt * tidy up file server tests + add more cases * start moving io wrappers to separate iotools package. Remove use of buffering while piping recache stream Signed-off-by: kim <grufwub@gmail.com> * add license text Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
0871f5d181
commit
6ebdc306ed
8 changed files with 503 additions and 214 deletions
|
|
@ -20,7 +20,6 @@ package media
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
|
@ -62,16 +61,3 @@ func parseFocus(focus string) (focusx, focusy float32, err error) {
|
|||
focusy = float32(fy)
|
||||
return
|
||||
}
|
||||
|
||||
type teeReadCloser struct {
|
||||
teeReader io.Reader
|
||||
close func() error
|
||||
}
|
||||
|
||||
func (t teeReadCloser) Read(p []byte) (n int, err error) {
|
||||
return t.teeReader.Read(p)
|
||||
}
|
||||
|
||||
func (t teeReadCloser) Close() error {
|
||||
return t.close()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue