@@ -100,16 +100,17 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
100100 p .Title = template .HTML (html .EscapeString (title ))
101101
102102 for _ , el := range files {
103- info , err := el .Info ()
104- if err != nil {
103+ info , errInfo := el .Info ()
104+ el , err := os .Stat (fullPath + "/" + el .Name ())
105+ if err != nil || errInfo != nil {
105106 log .Println ("error - cant stat a file" , err )
106107 continue
107108 }
108109
109110 if * skipHidden && strings .HasPrefix (el .Name (), "." ) {
110111 continue // dont print hidden files if we're not allowed
111112 }
112- if * symlinks && info .Mode ()& os .ModeSymlink != 0 {
113+ if ! * symlinks && info .Mode ()& os .ModeSymlink != 0 {
113114 continue // dont follow symlinks if we're not allowed
114115 }
115116
@@ -126,7 +127,7 @@ func replyList(w http.ResponseWriter, r *http.Request, fullPath string, path str
126127 } else {
127128 sl := strings .Split (name , "." )
128129 ext := strings .ToLower (sl [len (sl )- 1 ])
129- row := rowTemplate {name , template .URL (href ), humanize (info .Size ()), ext }
130+ row := rowTemplate {name , template .URL (href ), humanize (el .Size ()), ext }
130131 p .RowsFiles = append (p .RowsFiles , row )
131132 }
132133 }
0 commit comments