fix in routing

This commit is contained in:
Илья Глазунов 2025-12-03 02:14:05 +03:00
parent 1b462bd5f0
commit 2d445462c2
2 changed files with 5 additions and 8 deletions

View File

@ -22,18 +22,11 @@ extensions:
- type: routing
config:
regex_locations:
"=/":
root: "./docs"
index_file: "index.html"
"~*\\.(css)$":
root: "./docs"
cache_control: "public, max-age=3600"
"~*\\.html$":
root: "./docs"
cache_control: "no-cache"
"__default__":
root: "./docs"
index_file: "index.html"
cache_control: "no-cache"

View File

@ -123,6 +123,10 @@ class RequestHandler:
file_path = root / index_file
else:
file_path = root / path
# If path is a directory, look for index file
if file_path.is_dir():
index_file = config.get("index_file", "index.html")
file_path = file_path / index_file
try:
file_path = file_path.resolve()