mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 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:
parent
1ac46032fa
commit
b45cf73ed8
4 changed files with 20 additions and 3 deletions
|
|
@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue