mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
parent
f548041263
commit
cac954f10a
1 changed files with 7 additions and 2 deletions
|
|
@ -48,8 +48,13 @@ let html_list_dir ~top ~parent d : string =
|
|||
Array.iter
|
||||
(fun f ->
|
||||
if not @@ contains_dot_dot (d // f) then (
|
||||
Printf.bprintf body " <li> <a href=\"/%s\"> %s %s </a> </li>\n"
|
||||
(d // f) f (if Sys.is_directory (top // d // f) then "[dir]" else "");
|
||||
let fpath = top // d // f in
|
||||
if not @@ Sys.file_exists fpath then (
|
||||
Printf.bprintf body " <li> %s [invalid file]</li>\n" f
|
||||
) else (
|
||||
Printf.bprintf body " <li> <a href=\"/%s\"> %s %s </a> </li>\n"
|
||||
(d // f) f (if Sys.is_directory fpath then "[dir]" else "")
|
||||
);
|
||||
)
|
||||
)
|
||||
entries;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue