fix(P2-1): [FILE]-Block-Stripping nach fehlgeschlagenen Downloads in _download_and_inline_files

- Non-greedy Regex entfernt alle übrigen [FILE]...Download:... Blöcke nach der Download-Schleife
- Verhindert dass der Agent Download-URLs sieht wenn Downloads fehlschlagen
- 3 neue Tests: TestFileBlockStripping (fail-only, mixed success/fail, unicode filenames)
This commit is contained in:
Bernd (Hermes)
2026-07-24 04:57:15 +02:00
parent c0c505e73d
commit 342a1cddbb
2 changed files with 119 additions and 0 deletions
+6
View File
@@ -6006,6 +6006,12 @@ class RocketChatAdapter(BasePlatformAdapter):
block = f"\n\n[FILE CONTENT: {fname}]\n{content[:10000]}\n[/FILE]"
text += block
logger.debug("[rocketchat] Inlined file %s (%d chars)", fname, len(block))
# P2-1: Alle übrigen [FILE]-Blöcke entfernen (fehlgeschlagene Downloads)
# Non-greedy Pattern: erfasst [FILE]...Download:... bis zum nächsten \n
# re.DOTALL damit Zeilenumbrüche innerhalb des Blocks matchen
text = re.sub(
r'\[FILE\].*?Download:[^\n]+\n?', '', text, flags=re.DOTALL
)
return text
async def disconnect(self) -> None: