fix: skip .doc binary files unchanged + bump v0.4/v1.0.187
Deploy contracts-flask / validate (push) Successful in 0s
Deploy contracts-flask / validate (push) Successful in 0s
This commit is contained in:
@@ -208,7 +208,10 @@ class TwoPassObfuscator:
|
||||
all_texts[fname] = text
|
||||
if doc is not None:
|
||||
all_docx[fname] = doc
|
||||
self._scan_regex(text)
|
||||
elif text == "[DOC binary — not parsed]":
|
||||
pass # .doc без изменений
|
||||
else:
|
||||
self._scan_regex(text)
|
||||
|
||||
if self._llm_client:
|
||||
self._scan_llm_ner(all_texts)
|
||||
@@ -217,7 +220,10 @@ class TwoPassObfuscator:
|
||||
results = []
|
||||
for fname, content, ctype in files:
|
||||
obf_content = content
|
||||
if fname in all_docx:
|
||||
if fname.endswith('.doc'):
|
||||
# .doc — бинарный, оставляем как есть
|
||||
pass
|
||||
elif fname in all_docx:
|
||||
obf_content = self._replace_in_docx(all_docx[fname])
|
||||
elif fname.endswith('.pdf'):
|
||||
txt = all_texts.get(fname, '')
|
||||
@@ -310,8 +316,10 @@ class TwoPassObfuscator:
|
||||
text += "\n" + " | ".join(str(c) if c else "" for c in row)
|
||||
|
||||
elif ext == '.doc':
|
||||
# .doc: читаем как текст (конвертация через libreoffice не используется)
|
||||
text = content.decode('utf-8', errors='replace')
|
||||
# .doc — бинарный формат, без libreoffice не парсим
|
||||
# Пропускаем без изменений (не обфусцируем)
|
||||
text = "[DOC binary — not parsed]"
|
||||
return text, None
|
||||
|
||||
else:
|
||||
text = content.decode('utf-8', errors='replace')
|
||||
|
||||
Reference in New Issue
Block a user