Don't show PHP files

This commit is contained in:
Dendy 2024-01-24 16:59:18 +01:00
parent c9483141d4
commit 44cb528687
1 changed files with 2 additions and 1 deletions

View File

@ -37,7 +37,7 @@ def index(path):
render_template( render_template(
"error.html", "error.html",
code=404, code=404,
msg=f'The path "{path}" does not exist.' msg=f'The path "{path}" does not exist.',
), ),
404, 404,
) )
@ -46,6 +46,7 @@ def index(path):
if os.path.isdir(internal_path): if os.path.isdir(internal_path):
_, dirs, files = next(os.walk(internal_path)) _, dirs, files = next(os.walk(internal_path))
files = filter(lambda x: not x.endswith(".php"), files)
files = filter(lambda x: not x.startswith("."), files) files = filter(lambda x: not x.startswith("."), files)
dirs = filter(lambda x: not x.startswith("."), dirs) dirs = filter(lambda x: not x.startswith("."), dirs)