v0.0.53: устойчивость к битым файлам — воркер не падает, битые пропускаются, остальные обрабатываются
Deploy drhider / validate (push) Canceled after 0s

This commit is contained in:
“Naeel”
2026-08-20 08:30:30 +03:00
parent 3ae7d325e2
commit fe7c238c0b
3 changed files with 38 additions and 2 deletions
+15 -1
View File
@@ -114,6 +114,7 @@ class TwoPassObfuscator:
all_texts: Dict[str, str] = {}
total = len(files)
file_times: List[float] = [0.0] * total
skipped: set = set() # имена файлов, которые не удалось обработать (битые)
for i, (fname, content, ctype) in enumerate(files):
display_name = os.path.basename(fname) or fname
@@ -121,7 +122,14 @@ class TwoPassObfuscator:
progress_cb("start", i, total, display_name, 0.0)
t0 = time.time()
text = extractor.extract_text(fname, content, ctype)
try:
text = extractor.extract_text(fname, content, ctype)
except Exception as e:
log.warning("obfuscate: skip file %r: %r", fname, e)
skipped.add(fname)
if progress_cb:
progress_cb("done", i, total, display_name, 0.0)
continue
all_texts[fname] = text
# Regex-сканирование (быстрое, локальное)
@@ -145,6 +153,12 @@ class TwoPassObfuscator:
fname = in_fname
display_name = os.path.basename(in_fname) or in_fname
# Битый файл (не удалось извлечь текст) — пропускаем
if fname in skipped:
if progress_cb:
progress_cb("done", i, total, display_name, 0.0)
continue
t0 = time.time()
obf_content = content # По умолчанию — без изменений