mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-07 11:45:36 -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
|
Array.iter
|
||||||
(fun f ->
|
(fun f ->
|
||||||
if not @@ contains_dot_dot (d // f) then (
|
if not @@ contains_dot_dot (d // f) then (
|
||||||
|
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"
|
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 "");
|
(d // f) f (if Sys.is_directory fpath then "[dir]" else "")
|
||||||
|
);
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
entries;
|
entries;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue