diff --git a/deploy/services/drhider.py b/deploy/services/drhider.py index 1883670..7101322 100644 --- a/deploy/services/drhider.py +++ b/deploy/services/drhider.py @@ -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') diff --git a/site/services/drhider.py b/site/services/drhider.py index 1883670..7101322 100644 --- a/site/services/drhider.py +++ b/site/services/drhider.py @@ -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') diff --git a/site/templates/drhider.html b/site/templates/drhider.html index 54aeb87..6989bbc 100644 --- a/site/templates/drhider.html +++ b/site/templates/drhider.html @@ -64,7 +64,7 @@ Сверка договоров | DrHider - v0.3 + v0.4
diff --git a/site/templates/index.html b/site/templates/index.html index aa8410c..dd50c0d 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -73,7 +73,7 @@
Nubes - Сверка договоров — LLM AI-driven Event Sourcing v1.0.186-flask + Сверка договоров — LLM AI-driven Event Sourcing v1.0.187-flask
○ Загрузка ○ Классификация