feat(загрузка): свои пределы для архивов — 30 МБ на архив, 100 МБ на диалог, обычные файлы как были; версия 2026-10-08a

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
anor
2026-10-08 20:38:18 +10:00
co-authored by Claude Opus 5.5
parent 5c62b8b509
commit cfa1676d55
6 changed files with 129 additions and 37 deletions
+9
View File
@@ -60,6 +60,15 @@ def is_split_volume(filename) -> bool:
return any(rx.match(suf) for rx in _SPLIT_PART_RES)
ARCHIVE_EXT = {".zip", ".rar", ".7z"}
def is_archive_file(filename) -> bool:
"""Архив или том многотомника — для пределов загрузки. Только последнее расширение:
«смета.zip.xlsx» — обычный файл (так же смотрит is_allowed_file), «СМЕТА.ZIP» — архив."""
return Path(filename).suffix.lower() in ARCHIVE_EXT or is_split_volume(filename)
def _backend() -> str | None:
for tool in ("unar", "7z", "unrar"):
if shutil.which(tool):