Hide hidden folder (hacky)
alex wennerberg alex@alexwennerberg.com
Fri, 26 Feb 2021 21:26:42 -0800
1 files changed,
3 insertions(+),
0 deletions(-)
jump to
M
sftp.go
→
sftp.go
@@ -50,6 +50,9 @@ }
func (conn *Connection) Filelist(request *sftp.Request) (sftp.ListerAt, error) { fullpath := path.Join(c.FilesDirectory, filepath.Clean(request.Filepath)) + if strings.Contains(request.Filepath, ".hidden") { + return nil, fmt.Errorf("Invalid permissions") // TODO fix better + } switch request.Method { case "List": f, err := os.Open(fullpath)