@@ -52,7 +52,6 @@ async fn doc_handler(path: PathBuf, cluster: &Cluster) -> Result<ResponseOk, Sta
52
52
. expect ( "could not parse table of contents markdown" ) ;
53
53
let guides = markdown:: parse_summary_into_nav_links ( & mdast)
54
54
. expect ( "could not extract nav links from table of contents" ) ;
55
-
56
55
render (
57
56
cluster,
58
57
& path,
@@ -137,14 +136,21 @@ async fn render<'a>(
137
136
folder : & ' a Path ,
138
137
content : & ' a str ,
139
138
) -> 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
+ }
141
148
142
149
// Get the document content
143
150
let path = Path :: new ( & content)
144
151
. join ( folder)
145
- . join ( & ( path. to_str ( ) . unwrap ( ) . to_string ( ) + ".md" ) ) ;
152
+ . join ( & ( path. to_string ( ) + ".md" ) ) ;
146
153
147
- info ! ( "path: {:?}" , path) ;
148
154
// Read to string
149
155
let contents = match tokio:: fs:: read_to_string ( & path) . await {
150
156
Ok ( contents) => contents,
@@ -207,7 +213,7 @@ async fn render<'a>(
207
213
208
214
// Handle navigation
209
215
for nav_link in nav_links. iter_mut ( ) {
210
- nav_link. should_open ( & url. to_str ( ) . unwrap ( ) . to_string ( ) ) ;
216
+ nav_link. should_open ( & url) ;
211
217
}
212
218
213
219
let user = if cluster. context . user . is_anonymous ( ) {
0 commit comments