repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
efd5af1
parent
13d723d
author
Antonio Mika
date
2023-11-08 23:23:53 +0000 UTC
Added the ability to remove files using sftp
1 files changed,  +11, -1
M wish/send/sftp/handler.go
+11, -1
 1@@ -1,6 +1,7 @@
 2 package sftp
 3 
 4 import (
 5+	"bytes"
 6 	"errors"
 7 	"io"
 8 	"os"
 9@@ -31,7 +32,16 @@ type handler struct {
10 }
11 
12 func (f *handler) Filecmd(r *sftp.Request) error {
13-	return nil
14+	switch r.Method {
15+	case "Remove":
16+		entry := toFileEntry(r)
17+		entry.Reader = bytes.NewReader(nil)
18+
19+		_, err := f.writeHandler.Write(f.session, entry)
20+
21+		return err
22+	}
23+	return errors.New("unsupported")
24 }
25 
26 func (f *handler) Filelist(r *sftp.Request) (sftp.ListerAt, error) {