Skip to content

fix: percent-encode wiki file links - #629

Merged
sng-asyncfunc merged 1 commit into
AsyncFuncAI:mainfrom
GPT-AGI:fix-wiki-file-link-encoding
Nov 10, 2026
Merged

sng-asyncfunc merged 1 commit into
AsyncFuncAI:mainfrom
GPT-AGI:fix-wiki-file-link-encoding

Conversation

@GPT-AGI

@GPT-AGI GPT-AGI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

post_process_wiki_content inserted repository paths directly into Markdown destinations. For example, current main emits:

[src/app/(marketing)/page.tsx:10](.../src/app/(marketing)/page.tsx#L10).
CommonMark ends that destination at ), and a path such as docs/My Notes.md ends at the first space. The same broken URLs appear in the Relevant source files block.

Percent-encode branch and file path components for GitHub, GitLab, and Bitbucket. Slashes and existing %HH escapes stay unchanged, local paths are untouched, and link labels remain readable.

Verified on Python 3.12, Windows, from the clone:

.venv\Scripts\python.exe -m pytest -q tests/backend/services/test_wiki_content.py
20 passed
.venv\Scripts\python.exe -m ruff check api/services/wiki/content.py tests/backend/services/test_wiki_content.py
All checks passed

The regression tests cover all three hosts, spaces, parentheses, existing escapes, and local paths. ruff format --check still reports only three pre-existing long assertions in the test file.

Spaces and parentheses end a Markdown link destination, so a path such
as src/app/(marketing)/page.tsx or "docs/My Notes.md" never became a
repository URL. Encode the branch and the path, and leave local paths
unchanged.

Signed-off-by: Ting Zhang <181050363+GPT-AGI@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@sng-asyncfunc
sng-asyncfunc merged commit 4cdf247 into AsyncFuncAI:main Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants