flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit ea5e67c4e14bd7fc12d4a64118252a2dbc3a1abb
parent 6a448532723ac8abf673b4964260d8f4a4ed2fb2
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 27 Feb 2021 09:46:23 -0800

add rename command

Fix

Diffstat:
Msftp.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/sftp.go b/sftp.go @@ -76,12 +76,15 @@ func (conn *Connection) Filecmd(request *sftp.Request) error { // remove, rename, setstat? find out userDir := getUserDirectory(conn.User) // NOTE -- not cross platform fullpath := path.Join(userDir, filepath.Clean(request.Filepath)) + targetPath := path.Join(userDir, filepath.Clean(request.Target)) var err error switch request.Method { case "Remove": err = os.Remove(fullpath) case "Mkdir": err = os.Mkdir(fullpath, 0755) + case "Rename": + err = os.Rename(fullpath, targetPath) } if err != nil { return err