v0.0.53: устойчивость к битым файлам — воркер не падает, битые пропускаются, остальные обрабатываются
Deploy drhider / validate (push) Canceled after 0s
Deploy drhider / validate (push) Canceled after 0s
This commit is contained in:
+15
-1
@@ -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 # По умолчанию — без изменений
|
||||
|
||||
|
||||
Reference in New Issue
Block a user