add dot and dot dot directories to sftp/ftp file listing

This commit is contained in:
Nicola Murino
2021-07-31 09:42:23 +02:00
parent f778e47d22
commit a26962f367
9 changed files with 71 additions and 22 deletions

View File

@@ -608,3 +608,12 @@ func GetRedactedURL(rawurl string) string {
}
return u.Redacted()
}
// PrependFileInfo prepends a file info to a slice in an efficient way.
// We, optimistically, assume that the slice has enough capacity
func PrependFileInfo(files []os.FileInfo, info os.FileInfo) []os.FileInfo {
files = append(files, nil)
copy(files[1:], files)
files[0] = info
return files
}