RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(wiki): preserve external link navigation (#20517)
Mnimiy18c065f6b99d
diff --git a/web/src/utils/wiki-link-util.test.ts b/web/src/utils/wiki-link-util.test.tsindex 77bc8c39dd..02becae6cd 100644--- a/web/src/utils/wiki-link-util.test.ts+++ b/web/src/utils/wiki-link-util.test.ts@@ -15,4 +15,29 @@ describe('parseWikiLinkHref', () => {slug: 'location/长社',});});++ it.each([+ ['artifact/dataset/concept/人工智能', 'concept', '人工智能'],+ ['/artifact/dataset/entity/person/张角', 'entity', 'person/张角'],+ ['topic/智能体', 'topic', '智能体'],+ ['/entity/location/长社', 'entity', 'location/长社'],+ ])('preserves internal link %s', (href, pageType, slug) => {+ expect(parseWikiLinkHref(href)).toEqual({ pageType, slug });+ });++ it.each([+ 'https://example.com/topic/agents',+ 'http://example.com/entity/person/张角',+ '//example.com/concept/agents',+ '\\\\evil.example/topic/page',+ '/\\evil.example/topic/page',+ '\\/evil.example/topic/page',+ 'https://example.com/artifact/dataset/entity/alice',+ 'HTTPS://example.com/topic/agents',+ ' //example.com/topic/agents ',+ 'web+wiki.1://example.com/topic/agents',+ 'mailto:[email protected]/topic/agents',+ ])('does not treat external URL %s as an internal wiki link', (href) => {+ expect(parseWikiLinkHref(href)).toBeNull();+ });});diff --git a/web/src/utils/wiki-link-util.ts b/web/src/utils/wiki-link-util.tsindex 828cf94b1c..0e1f31e528 100644--- a/web/src/utils/wiki-link-util.ts+++ b/web/src/utils/wiki-link-util.ts@@ -17,6 +17,9 @@ export function parseWikiLinkHref(const normalized = href.trim();if (!normalized) return null;+ // Leave URLs with a scheme or authority to normal link navigation.+ if (/^(?:[a-z][a-z\d+.-]*:|[\\/]{2})/i.test(normalized)) return null;+// Prefer the artifact/{datasetId}/{pageType}/{slug} form.const artifactMatch = normalized.match(/(?:^|\/)artifact\/[^/]+\/(entity|concept|topic)\/([^\s"']+)/,