Wiki pages with special characters in mirrors are broken #4014

Closed
opened 2025-11-02 05:34:12 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Tekaoh on GitHub (Sep 25, 2019).

Description

Github allows you to use special characters in the titles of wiki pages. If you mirror a Github repository with Gitea, it pulls the wiki as well. However, any wiki pages with special characters in the titles cannot be accessed. They redirect to /wiki/_pages instead.

Originally created by @Tekaoh on GitHub (Sep 25, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.10.0+dev-327-ga8c024043 (try.gitea.io) - Git version: 2.17.1 (at least on my system. I don't know what try.gitea.io is using. Probably doesn't matter) - Operating system: Ubuntu - Database (use `[x]`): - [x] MySQL - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) https://try.gitea.io/Tekaoh/gitea-wiki-test/wiki/Title-with-comma%2C-ampersand-%26-%5Bbrackets%5D (working wiki page being mirrored is at https://github.com/Tekaoh/gitea-wiki-test/wiki/Title-with-comma,-ampersand-&-%5Bbrackets%5D) ## Description Github allows you to use special characters in the titles of wiki pages. If you mirror a Github repository with Gitea, it pulls the wiki as well. However, any wiki pages with special characters in the titles cannot be accessed. They redirect to `/wiki/_pages` instead.
GiteaMirror added the type/bug label 2025-11-02 05:34:12 -06:00
Author
Owner

@Tekaoh commented on GitHub (Oct 6, 2019):

I did some deeper digging and found that when you make a wiki page with special characters in the title from within Gitea (instead of from a mirror), it saves the file with escaped characters in the filename. So my solution at #8374 would break any existing wiki pages with special characters in the title because Gitea would be looking for unescaped characters in the filename.

This presents a more complex issue. As it stands right now, a wiki page with special characters in the name does work, but the filename contains escaped characters (Title-with-comma%2C-ampersand-%26-%5Bbrackets%5D.md). The same wiki page from a mirror is broken because the filename contains unescaped characters (Title-with-comma,-ampersand-&-[brackets].md). If we change Gitea to look for filenames with unescaped characters, the reverse will be true.

One way to fix this would be to have Gitea look for an escaped filename first and if it finds none, look again for an unescaped filename. If it finds one, use that. This would allow Gitea to find filenames that are saved either way. This is the solution presented in #8408

My personal opinion is that Gitea should be saving the filenames with unescaped characters as well. Sometimes these wikis are cloned and edited locally. Unescaped filenames are better for that. If Gitea is changed to look for both escaped and unescaped filenames, it could also optionally be changed to save new wiki pages with unescaped characters instead. Also, it could be changed so that any edits made with the Gitea editor to filenames with escaped characters could result in the file being re-saved with unescaped characters.
^ I'm going to separate that into another issue. #8410

@Tekaoh commented on GitHub (Oct 6, 2019): I did some deeper digging and found that when you make a wiki page with special characters in the title from within Gitea (instead of from a mirror), it saves the file with escaped characters in the filename. So my solution at #8374 would break any existing wiki pages with special characters in the title because Gitea would be looking for unescaped characters in the filename. This presents a more complex issue. As it stands right now, a wiki page with special characters in the name does work, but the filename contains escaped characters (`Title-with-comma%2C-ampersand-%26-%5Bbrackets%5D.md`). The same wiki page from a mirror is broken because the filename contains unescaped characters (`Title-with-comma,-ampersand-&-[brackets].md`). If we change Gitea to look for filenames with unescaped characters, the reverse will be true. One way to fix this would be to have Gitea look for an escaped filename first and if it finds none, look again for an unescaped filename. If it finds one, use that. This would allow Gitea to find filenames that are saved either way. This is the solution presented in #8408 ~~My personal opinion is that Gitea should be saving the filenames with unescaped characters as well. Sometimes these wikis are cloned and edited locally. Unescaped filenames are better for that. If Gitea is changed to look for both escaped and unescaped filenames, it could also optionally be changed to save new wiki pages with unescaped characters instead. Also, it could be changed so that any edits made with the Gitea editor to filenames with escaped characters could result in the file being re-saved with unescaped characters.~~ ^ I'm going to separate that into another issue. #8410
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4014