From 6affe29775eb0361357991decd7de3428d873d17 Mon Sep 17 00:00:00 2001 From: GeiserX <9169332+GeiserX@users.noreply.github.com> Date: Sun, 15 Feb 2026 14:15:29 +0100 Subject: [PATCH] fix: resolve chat search returning no results due to limit mismatch The search bar sent limit=1000 but the API enforced le=500, causing FastAPI to reject every search request with a silent 422 error. Also fixed DISPLAY_CHAT_IDS mode ignoring the search parameter entirely. --- docs/CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- src/web/main.py | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a3c91ab..f5fafaf 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,6 +6,13 @@ For upgrade instructions, see [Upgrading](#upgrading) at the bottom. ## [Unreleased] +## [6.2.15] - 2026-02-15 + +### Fixed + +- **Chat search broken (silent 422 error)** — The search bar sent `limit=1000` but the API enforced `le=500`, causing FastAPI to reject every search request with a 422 validation error. The frontend silently swallowed the error, making search appear to return no results. Raised the API limit to 1000 to match the frontend. +- **Chat search ignored in DISPLAY_CHAT_IDS mode** — When `DISPLAY_CHAT_IDS` was configured, the search query was never passed to the database, so typing in the search bar had no effect on the displayed chats. + ## [6.2.14] - 2026-02-13 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 0e681c5..6704c25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "telegram-archive" -version = "6.2.14" +version = "6.2.15" description = "Automated Telegram backup with Docker. Performs incremental backups of messages and media on a configurable schedule." readme = "README.md" requires-python = ">=3.14" diff --git a/src/web/main.py b/src/web/main.py index 02a52a6..c1a52cd 100644 --- a/src/web/main.py +++ b/src/web/main.py @@ -531,7 +531,7 @@ def _get_cached_avatar_path(chat_id: int, chat_type: str) -> str | None: @app.get("/api/chats", dependencies=[Depends(require_auth)]) async def get_chats( - limit: int = Query(50, ge=1, le=500, description="Number of chats to return"), + limit: int = Query(50, ge=1, le=1000, description="Number of chats to return"), offset: int = Query(0, ge=0, description="Offset for pagination"), search: str = Query(None, description="Search query for chat names/usernames"), archived: bool | None = Query(None, description="Filter by archived status"), @@ -548,7 +548,7 @@ async def get_chats( # If display_chat_ids is configured, we need to load all matching chats # Otherwise, use pagination if config.display_chat_ids: - chats = await db.get_all_chats(archived=archived, folder_id=folder_id) + chats = await db.get_all_chats(search=search, archived=archived, folder_id=folder_id) chats = [c for c in chats if c["id"] in config.display_chat_ids] total = len(chats) # Apply pagination after filtering