mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-04-29 19:10:51 -05:00
fix(files): update all callers to provide seekable readers for S3 uploads
Update all code paths that pass file content to the storage layer to provide io.ReadSeeker instead of io.Reader: - Avatar upload: use bytes.NewReader instead of bytes.Buffer - Background upload handler: use bytes.NewReader instead of bytes.Buffer - Unsplash background: buffer response body into bytes.NewReader - Dump restore: buffer zip entry into bytes.NewReader - Migration structure: pass bytes.NewReader directly instead of wrapping in io.NopCloser - Task attachment: change NewAttachment parameter from io.ReadCloser to io.ReadSeeker
This commit is contained in:
@@ -58,8 +58,7 @@ func (*TaskAttachment) TableName() string {
|
||||
}
|
||||
|
||||
// NewAttachment creates a new task attachment
|
||||
// Note: I'm not sure if only accepting an io.ReadCloser and not an afero.File or os.File instead is a good way of doing things.
|
||||
func (ta *TaskAttachment) NewAttachment(s *xorm.Session, f io.ReadCloser, realname string, realsize uint64, a web.Auth) error {
|
||||
func (ta *TaskAttachment) NewAttachment(s *xorm.Session, f io.ReadSeeker, realname string, realsize uint64, a web.Auth) error {
|
||||
|
||||
// Store the file
|
||||
file, err := files.Create(f, realname, realsize, a)
|
||||
|
||||
Reference in New Issue
Block a user