From 2d445462c2505d9437b89b40b34bb473a30cb6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=20=D0=93=D0=BB=D0=B0=D0=B7=D1=83?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2?= Date: Wed, 3 Dec 2025 02:14:05 +0300 Subject: [PATCH] fix in routing --- config.docs.yaml | 9 +-------- pyserve/routing.py | 4 ++++ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/config.docs.yaml b/config.docs.yaml index 9694eb1..f7d431f 100644 --- a/config.docs.yaml +++ b/config.docs.yaml @@ -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" diff --git a/pyserve/routing.py b/pyserve/routing.py index df22085..18c8f7b 100644 --- a/pyserve/routing.py +++ b/pyserve/routing.py @@ -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()