Properly handle directory read errors
This commit is contained in:
parent
7078068435
commit
2d9176ef14
7
main.go
7
main.go
|
@ -142,7 +142,12 @@ func listFiles(conn net.Conn, rpath string) {
|
|||
if rpath == "/" {
|
||||
path = "/"
|
||||
}
|
||||
list, _ := os.ReadDir(path)
|
||||
list, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
e := fmt.Sprint(err)
|
||||
sendMessage(Response{Successful: false, Message: e}, conn)
|
||||
return
|
||||
}
|
||||
|
||||
newList := FileList{}
|
||||
for _, v := range list {
|
||||
|
|
Loading…
Reference in New Issue