dashboard / send / fix(sftp): only call `writeHandler.Write` once during PUT #40 rss

open · opened on 2025-01-10T02:33:23Z by erock
Help
# add changes to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add 40
# add review to patch request
git format-patch main --stdout | ssh pr.pico.sh pr add --review 40
# remove patchset
ssh pr.pico.sh ps rm ps-x
# checkout all patches
ssh pr.pico.sh pr print 40 | git am -3
# print a diff between the last two patches in a patch request
ssh pr.pico.sh pr diff 40
# accept PR
ssh pr.pico.sh pr accept 40
# close PR
ssh pr.pico.sh pr close 40

Logs

erock created pr with ps-86 on 2025-01-10T02:33:23Z

Patchsets

ps-86 by erock on 2025-01-10T02:33:23Z

fix(sftp): only call `writeHandler.Write` once during PUT

protocols/sftp/handler.go link
+0 -8
 1diff --git a/protocols/sftp/handler.go b/protocols/sftp/handler.go
 2index 4ed2799..e1d7867 100644
 3--- a/protocols/sftp/handler.go
 4+++ b/protocols/sftp/handler.go
 5@@ -1,7 +1,6 @@
 6 package sftp
 7 
 8 import (
 9-	"bytes"
10 	"errors"
11 	"io"
12 	"io/fs"
13@@ -118,13 +117,6 @@ func toFileEntry(r *sftp.Request) *utils.FileEntry {
14 
15 func (f *handler) Filewrite(r *sftp.Request) (io.WriterAt, error) {
16 	entry := toFileEntry(r)
17-	entry.Reader = bytes.NewReader([]byte{})
18-
19-	_, err := f.writeHandler.Write(f.session, entry)
20-	if err != nil {
21-		return nil, err
22-	}
23-
24 	buf := &buffer{}
25 	entry.Reader = buf
26