🎨 API /api/file/readDir support for returning symbolic link information (#8805)

* 🎨 API `/api/file/readDir` response symlink info

* 🎨 distinguish between directory symlink and file symlink
This commit is contained in:
Yingyi / 颖逸 2023-07-22 22:20:24 +08:00 committed by GitHub
parent 1ac46032fa
commit b45cf73ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 3 deletions

View file

@ -172,9 +172,18 @@ func readDir(c *gin.Context) {
files := []map[string]interface{}{}
for _, entry := range entries {
path := filepath.Join(dirPath, entry.Name())
info, err = os.Stat(path)
if nil != err {
logging.LogErrorf("stat [%s] failed: %s", path, err)
ret.Code = 500
ret.Msg = err.Error()
return
}
files = append(files, map[string]interface{}{
"name": entry.Name(),
"isDir": entry.IsDir(),
"name": entry.Name(),
"isDir": info.IsDir(),
"isSymlink": util.IsSymlink(entry),
})
}