From 7078068435464afc6b62450ccf64904151727011 Mon Sep 17 00:00:00 2001 From: raul Date: Mon, 17 Jun 2024 13:25:21 +0200 Subject: [PATCH] Resolve symlinks to determine file type --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 9fd6195..df386af 100644 --- a/main.go +++ b/main.go @@ -146,10 +146,19 @@ func listFiles(conn net.Conn, rpath string) { newList := FileList{} for _, v := range list { + var isDir bool + + f, err := os.Stat(path + v.Name()) + if err != nil { + continue + } + if f.IsDir() == true { + isDir = true + } item := Item{ Name: v.Name(), FullPath: path + v.Name(), - IsFolder: v.IsDir(), + IsFolder: isDir, } newList.File = append(newList.File, item) }