From 075ad515af3958f476a220279ff946f6e7e52442 Mon Sep 17 00:00:00 2001 From: Vladless Date: Thu, 7 May 2026 18:17:26 +0000 Subject: [PATCH] Backend: cli safe_prompt strips non-ascii instead of rejecting whole input. Frontend: fetch pdf as blob in tg webapp. --- cli_launcher.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cli_launcher.py b/cli_launcher.py index d67e426e..e89d7422 100644 --- a/cli_launcher.py +++ b/cli_launcher.py @@ -276,7 +276,12 @@ def safe_confirm(message: str, **kwargs) -> bool: def safe_prompt(message: str, **kwargs) -> str: - """Безопасный Prompt.ask с защитой от русской раскладки.""" + """Безопасный Prompt.ask с защитой от русской раскладки. + + Не-ASCII символы тихо фильтруются. Предупреждение появляется только + если после фильтрации в строке не осталось значимого ASCII (т.е. ввод + был полностью на не-английской раскладке). + """ while True: try: value = Prompt.ask(message, **kwargs) @@ -287,8 +292,11 @@ def safe_prompt(message: str, **kwargs) -> str: console.print(f"[red]{e}[/red]") continue if isinstance(value, str) and not is_ascii_only(value): - warn_english_only() - continue + cleaned = "".join(ch for ch in value if ord(ch) < 128) + if not cleaned.strip(): + warn_english_only() + continue + return cleaned return value