@@ -52,7 +52,6 @@ async fn doc_handler(path: PathBuf, cluster: &Cluster) -> Result<ResponseOk, Sta
5252. expect ( "could not parse table of contents markdown" ) ;
5353let guides = markdown:: parse_summary_into_nav_links ( & mdast)
5454. expect ( "could not extract nav links from table of contents" ) ;
55-
5655render (
5756 cluster,
5857& path,
@@ -137,14 +136,21 @@ async fn render<'a>(
137136folder : & ' a Path ,
138137content : & ' a str ,
139138) ->Result < ResponseOk , Status > {
140- let url = path. clone ( ) ;
139+ let mut path = path
140+ . to_str ( )
141+ . expect ( "path must convert to a string" )
142+ . to_string ( ) ;
143+ let mut url = path. clone ( ) ;
144+ if path. ends_with ( "/" ) {
145+ path. push_str ( "README" ) ;
146+ url. push_str ( "./" ) ;
147+ }
141148
142149// Get the document content
143150let path =Path :: new ( & content)
144151. join ( folder)
145- . join ( & ( path. to_str ( ) . unwrap ( ) . to_string ( ) +".md" ) ) ;
152+ . join ( & ( path. to_string ( ) +".md" ) ) ;
146153
147- info ! ( "path: {:?}" , path) ;
148154// Read to string
149155let contents =match tokio:: fs:: read_to_string ( & path) . await {
150156Ok ( contents) => contents,
@@ -207,7 +213,7 @@ async fn render<'a>(
207213
208214// Handle navigation
209215for nav_linkin nav_links. iter_mut ( ) {
210- nav_link. should_open ( & url. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
216+ nav_link. should_open ( & url) ;
211217}
212218
213219let user =if cluster. context . user . is_anonymous ( ) {