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(markdown): preserve multi-dot filenames during resource parsing (#1875)
zexuyann7fa499a9b7ef
diff --git a/openviking/parse/parsers/markdown.py b/openviking/parse/parsers/markdown.pyindex d84285925..447053a3c 100644--- a/openviking/parse/parsers/markdown.py+++ b/openviking/parse/parsers/markdown.py@@ -211,13 +211,15 @@ class MarkdownParser(BaseParser):await viking_fs.mkdir(temp_uri)logger.debug(f"[MarkdownParser] Created temp directory: {temp_uri}")- explicit_name = kwargs.get("resource_name") or kwargs.get("source_name")+ explicit_name = kwargs.get("resource_name")+ if not explicit_name and kwargs.get("source_name"):+ explicit_name = _smart_stem(kwargs["source_name"])# Preserve the original uploaded filename when available instead of# the temp upload name (e.g. upload_<uuid>.txt).doc_title = meta.get("frontmatter", {}).get("title",- _smart_stem(explicit_name)+ explicit_nameif explicit_nameelse _smart_stem(source_path)if source_pathdiff --git a/tests/parse/test_filename_safety.py b/tests/parse/test_filename_safety.pyindex 0d8b85919..aecd4d62a 100644--- a/tests/parse/test_filename_safety.py+++ b/tests/parse/test_filename_safety.py@@ -3,6 +3,9 @@"""Tests for filename safety: hash & shorten when names are too long (issue #171)."""import hashlib+from unittest.mock import AsyncMock, patch++import pytestclass TestSanitizeForPath:@@ -108,6 +111,27 @@ class TestGenerateMergedFilename:assert len(result) <= 32+async def test_markdown_resource_name_is_not_stemmed_again():+ from openviking.parse.parsers.markdown import MarkdownParser++ parser = MarkdownParser()+ mock_vfs = type("MockVikingFS", (), {})()+ mock_vfs.create_temp_uri = lambda: "viking://temp/test"+ mock_vfs.mkdir = AsyncMock()+ mock_vfs.write_file = AsyncMock()++ with patch.object(parser, "_get_viking_fs", return_value=mock_vfs):+ result = await parser.parse_content(+ "short body",+ source_path="/tmp/upload.yaml",+ resource_name="access.dns.md",+ )++ assert result.root.title == "access.dns.md"+ mock_vfs.mkdir.assert_any_await("viking://temp/test/access.dns.md")++class TestShortenComponent:"""Test VikingFS._shorten_component."""