replace hand-written slice utilities with methods from slices package

SFTPGo depends on Go 1.22 so we can use slices package

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-07-24 18:17:55 +02:00
parent 6ba1198c47
commit bd5eb03d9c
4 changed files with 11 additions and 21 deletions

View File

@@ -221,9 +221,9 @@ func (c *Connection) Filelist(request *sftp.Request) (sftp.ListerAt, error) {
}
modTime := time.Unix(0, 0)
if request.Filepath != "/" {
lister.Add(vfs.NewFileInfo("..", true, 0, modTime, false))
lister.Prepend(vfs.NewFileInfo("..", true, 0, modTime, false))
}
lister.Add(vfs.NewFileInfo(".", true, 0, modTime, false))
lister.Prepend(vfs.NewFileInfo(".", true, 0, modTime, false))
return lister, nil
case "Stat":
if !c.User.HasPerm(dataprovider.PermListItems, path.Dir(request.Filepath)) {