Skip to content

Commit 06bd403

Browse files
committed
Append \index.html if a trailing slash is found in docs path
1 parent fd2d52e commit 06bd403

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

main.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,22 @@ def serve_vue_app(filename):
7272
"""
7373
return send_from_directory('dist', filename)
7474

75-
@app.route('/docs/<path:filename>')
76-
def serve_docs_app(filename):
75+
@app.route('/docs/')
76+
def redirect_docs_app():
77+
return redirect('/docs/index.html', code=302)
78+
79+
@app.route('/docs/<path:subpath>')
80+
def serve_docs_app(subpath):
7781
"""
7882
Serve (a build of) the documentation
7983
'cb_docs' is the output of `npx vuepress build pages/`
8084
from the 'docs' repository
8185
"""
82-
return send_from_directory('cb_docs', filename)
86+
print("Running docs path")
87+
print(subpath)
88+
if (subpath[-1] == '/'):
89+
subpath = subpath + 'index.html'
90+
return send_from_directory('cb_docs', subpath)
8391

8492
@app.route('/')
8593
def redirect_vue_app():

0 commit comments

Comments
 (0)