fix: convert wiki page titles to sub_url slugs for get/edit/delete#6
Open
Lcstyle wants to merge 1 commit intoraohwork:masterfrom
Open
fix: convert wiki page titles to sub_url slugs for get/edit/delete#6Lcstyle wants to merge 1 commit intoraohwork:masterfrom
Lcstyle wants to merge 1 commit intoraohwork:masterfrom
Conversation
The Gitea API expects the sub_url slug format for wiki page endpoints, not the display title. This caused 404 errors when callers passed page titles (e.g. "architecture/overview") to get_wiki_page, edit_wiki_page, or delete_wiki_page. The new wikiPageNameToSlug helper converts titles to slugs: - Replaces spaces with hyphens - URL-encodes path separators (/ -> %2F) - Appends ".-" suffix for pages with path separators (Gitea convention) - Passes through already-encoded sub_url values unchanged Includes 7 unit tests covering flat pages, nested pages, deep nesting, spaces, and already-encoded passthrough. Fixes raohwork#5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_wiki_page,edit_wiki_page, anddelete_wiki_pagenow accept display titles (e.g.architecture/overview) in addition to rawsub_urlslugswikiPageNameToSlughelper converts titles to Gitea's expected slug format: spaces → hyphens,/→%2F, append.-suffix for nested pagessub_urlvalues pass through unchanged (no double-encoding)Problem
When an MCP client lists wiki pages via
list_wiki_pagesand sees a title likearchitecture/signal-processing-strategies, it naturally passes that title toget_wiki_page. But Gitea's API expects thesub_urlslug format (architecture%2Fsignal-processing-strategies.-), resulting in a 404.See #5 for full reproduction steps.
Test plan
TestWikiPageNameToSlugtests pass🤖 Generated with Claude Code