fixes in dir module

This commit is contained in:
Simon Cruanes 2022-03-17 22:42:36 -04:00
parent 6706589c62
commit d5c828978d
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -117,7 +117,7 @@ let html_list_dir (module VFS:VFS) ~prefix ~parent d : Html.elt =
begin match parent with
| None -> ()
| Some p ->
out @< a[A.href (encode_path (prefix // p))][txt"(parent directory)"];
out @< a[A.href (encode_path ("/" // prefix // p))][txt"(parent directory)"];
end;
out @< ul'[] @@ fun out ->
@ -242,7 +242,7 @@ let add_vfs_ ~on_fs ~top ~config ~vfs:((module VFS:VFS) as vfs) ~prefix server :
) else if VFS.is_directory path then (
S._debug (fun k->k "list dir %S (topdir %S)" path VFS.descr);
let parent = Filename.(dirname path) in
let parent = if parent <> "." && parent <> path then Some parent else None in
let parent = if path <> "." then Some parent else None in
match config.dir_behavior with
| Index | Index_or_lists when VFS.contains (path // "index.html") ->
(* redirect using path, not full path *)