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

closed · opened on 2025-01-10T02:33:23Z by erock
Help
checkout latest patchset:
ssh pr.pico.sh print pr-40 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3
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
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
erock changed status on 2025-02-01T18:44:02Z {"status":"closed"}

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