From de6bea5b9751efc1187ff10fddfd9918f22f06bc Mon Sep 17 00:00:00 2001 From: Nikita Kozyrev Date: Mon, 14 Jul 2025 22:00:01 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B0=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20.yaml-=D1=84=D0=B0=D0=B9=D0=BB=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B2=20=D1=8D=D0=BD=D0=B4=D0=BF=D0=BE=D0=B8=D0=BD?= =?UTF-8?q?=D1=82=D0=B5=20/courses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 5d2c207..55b81e8 100644 --- a/main.py +++ b/main.py @@ -85,7 +85,13 @@ def logout(response: Response): @app.get("/courses") def get_courses(): courses = [] - for index, filename in enumerate(sorted(os.listdir(COURSES_DIR)), start=1): + # FIX: фильтрация только .yaml-файлов + yaml_files = [ + f for f in os.listdir(COURSES_DIR) + if f.endswith(".yaml") and os.path.isfile(os.path.join(COURSES_DIR, f)) + ] + yaml_files.sort() + for index, filename in enumerate(yaml_files, start=1): file_path = os.path.join(COURSES_DIR, filename) if filename.endswith(".yaml") and os.path.isfile(file_path): with open(file_path, "r", encoding="utf-8") as file: