Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(parser): fix temporary file leak in HTMLParser download link handling (#95)
LettuceLeaves81df7e3bc300
diff --git a/openviking/parse/parsers/html.py b/openviking/parse/parsers/html.pyindex c71eceed0..7e867a3e2 100644--- a/openviking/parse/parsers/html.py+++ b/openviking/parse/parsers/html.py@@ -351,6 +351,7 @@ class HTMLParser(BaseParser):Returns:ParseResult from delegated parser"""+ temp_path = Nonetry:# Download to temporary filetemp_path = await self._download_file(url)@@ -358,36 +359,25 @@ class HTMLParser(BaseParser):# Get appropriate parserif file_type == "pdf":from openviking.parse.parsers.pdf import PDFParser-parser = PDFParser()+ result = await parser.parse(temp_path)elif file_type == "markdown":from openviking.parse.parsers.markdown import MarkdownParser-parser = MarkdownParser()+ result = await parser.parse(temp_path)elif file_type == "text":from openviking.parse.parsers.text import TextParser-parser = TextParser()+ result = await parser.parse(temp_path)elif file_type == "html":# Parse downloaded HTML locallyreturn await self._parse_local_file(Path(temp_path), start_time, **kwargs)else:raise ValueError(f"Unsupported file type: {file_type}")- # Parse downloaded file- result = await parser.parse(temp_path)-- # Update metadataresult.meta.update(meta)result.meta["downloaded_from"] = urlresult.meta["url_type"] = f"download_{file_type}"-- # Clean up temp file- try:- Path(temp_path).unlink()- except Exception:- pass-return resultexcept Exception as e:@@ -399,6 +389,14 @@ class HTMLParser(BaseParser):parse_time=time.time() - start_time,warnings=[f"Failed to download/parse link: {e}"],)+ finally:+ if temp_path:+ try:+ p = Path(temp_path)+ if p.exists():+ p.unlink()+ except Exception:+ passasync def _handle_code_repository(self, url: str, start_time: float, meta: Dict[str, Any], **kwargs