wiki: URL encoding bug #1842

Closed
opened 2025-11-02 04:14:51 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @ghost on GitHub (May 31, 2018).

Description

Since #4058, the links are no longer encoded.
But the URLs(files name) of the existing pages or new pages are still encoded.

The original link is
https://try.gitea.io/yasuokav/link-test/wiki/Test%3F
but now is
https://try.gitea.io/yasuokav/link-test/wiki/Test?

Screenshots

N/A

Originally created by @ghost on GitHub (May 31, 2018). - Gitea version (or commit ref): 728cc27 - Git version: N/A - Operating system: N/A - Database (use `[x]`): N/A - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - https://try.gitea.io/yasuokav/link-test/wiki/Home - [ ] No - [ ] Not relevant - Log gist: N/A ## Description Since #4058, the links are no longer encoded. But the URLs(files name) of the existing pages or new pages are still encoded. The original link is `https://try.gitea.io/yasuokav/link-test/wiki/Test%3F` but now is `https://try.gitea.io/yasuokav/link-test/wiki/Test?` ## Screenshots N/A
GiteaMirror added the type/bug label 2025-11-02 04:14:51 -06:00
Author
Owner

@sapk commented on GitHub (May 31, 2018):

I couldn't reproduce on the try.gitea.io link but maybe I didn't understand the bug.

@sapk commented on GitHub (May 31, 2018): I couldn't reproduce on the try.gitea.io link but maybe I didn't understand the bug.
Author
Owner

@ghost commented on GitHub (May 31, 2018):

@sapk When you click "Click Me" it will lead you to https://try.gitea.io/yasuokav/link-test/wiki/_pages
instead of
https://try.gitea.io/yasuokav/link-test/wiki/Test%3F

Because the URL is no longer encoded as /yasuokav/link-test/wiki/Test%3F

<a href="/yasuokav/link-test/wiki/Test?" rel="nofollow">Click Me</a>
@ghost commented on GitHub (May 31, 2018): @sapk When you click "Click Me" it will lead you to `https://try.gitea.io/yasuokav/link-test/wiki/_pages` instead of `https://try.gitea.io/yasuokav/link-test/wiki/Test%3F` Because the URL is no longer encoded as `/yasuokav/link-test/wiki/Test%3F` ``` <a href="/yasuokav/link-test/wiki/Test?" rel="nofollow">Click Me</a> ```
Author
Owner

@sapk commented on GitHub (May 31, 2018):

I see, but that logical the file is name : Test%3F
I would see it more like a bug fixed by #4058
In your markdown, [Click Me](Test?) should be [Click Me](Test%3F)

If I take github as a reference :
[Click Me](Test?) -> Click Me
[Click Me](Test%3F) -> Click Me

But we should notice it at the release that it could break some links.

@sapk commented on GitHub (May 31, 2018): I see, but that logical the file is name : Test%3F I would see it more like a bug fixed by #4058 In your markdown, `[Click Me](Test?)` should be `[Click Me](Test%3F)` If I take github as a reference : `[Click Me](Test?)` -> [Click Me](Test?) `[Click Me](Test%3F)` -> [Click Me](Test%3F) But we should notice it at the release that it could break some links.
Author
Owner

@ghost commented on GitHub (May 31, 2018):

@sapk Yes, you're right. But it will break some links if I use

[[Test?]]

Only [[Test%3F]] will work, but it looks bad.

Maybe we shouldn't encode the file name.

@ghost commented on GitHub (May 31, 2018): @sapk Yes, you're right. But it will break some links if I use ``` [[Test?]] ``` Only `[[Test%3F]]` will work, but it looks bad. Maybe we shouldn't encode the file name.
Author
Owner

@sapk commented on GitHub (May 31, 2018):

We need to encode the filename (in url) are those char are specials. But in case of Test? maybe url-encode the reference (link) to the page but not the title displayed.

@sapk commented on GitHub (May 31, 2018): We need to encode the filename (in url) are those char are specials. But in case of [[Test?]] maybe url-encode the reference (link) to the page but not the title displayed.
Author
Owner

@sapk commented on GitHub (May 31, 2018):

I would just be encode link here before URLJoin but I will have to test this before PR.

@sapk commented on GitHub (May 31, 2018): I would just be encode link [here](https://github.com/go-gitea/gitea/blob/69ea5e438538863056af3bd70d182096b68f0d4a/modules/markup/html.go#L511) before URLJoin but I will have to test this before PR.
Author
Owner

@lunny commented on GitHub (Jun 15, 2018):

should be closed by #4091

@lunny commented on GitHub (Jun 15, 2018): should be closed by #4091
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1842