raw wiki files return 404 #1540

Closed
opened 2025-11-02 04:04:21 -06:00 by GiteaMirror · 13 comments
Owner

Originally created by @TankTheFrank on GitHub (Feb 17, 2018).

Description

Raw files need to have '.md' added as extension to be served.

They are served by repo.WikiRaw() which does this:

...
wikiPath := models.WikiNameToFilename(providedPath)
...

models.WikiNameToFilename is a short function:

// WikiNameToFilename converts a wiki name to its corresponding filename.
func WikiNameToFilename(name string) string {
	name = strings.Replace(name, " ", "-", -1)
	return url.QueryEscape(name) + ".md"
}

Shortly put ".md" is appended to the path, in order to get a raw file from the repo, say "file.txt" it has to be saved as "file.txt.md" and it will be available as "wiki/raw/file.txt".

Originally created by @TankTheFrank on GitHub (Feb 17, 2018). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) 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): b29c3583156ad51d57e24c62eb540290410e9608 - Git version: not relevant - Operating system: not relevant - Database (use `[x]`): not relevant - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant https://try.gitea.io/testerxxx/test-wiki/wiki/raw/file.txt - Log gist: ## Description Raw files need to have '.md' added as extension to be served. They are served by repo.WikiRaw() which does this: ``` ... wikiPath := models.WikiNameToFilename(providedPath) ... ``` models.WikiNameToFilename is a short function: ``` // WikiNameToFilename converts a wiki name to its corresponding filename. func WikiNameToFilename(name string) string { name = strings.Replace(name, " ", "-", -1) return url.QueryEscape(name) + ".md" } ``` Shortly put ".md" is appended to the path, in order to get a raw file from the repo, say "file.txt" it has to be saved as "file.txt.md" and it will be available as "wiki/raw/file.txt".
GiteaMirror added the type/bug label 2025-11-02 04:04:21 -06:00
Author
Owner
@thehowl commented on GitHub (Feb 20, 2018): Seems to work fine here: https://try.gitea.io/testerxxx/test-wiki/wiki/raw/Home.md https://try.gitea.io/testerxxx/test-wiki/wiki/raw/Home
Author
Owner

@TankTheFrank commented on GitHub (Feb 27, 2018):

"raw files" means non-md files, files that are not markdown and not supposed to be parsed like images, text, etc.

@TankTheFrank commented on GitHub (Feb 27, 2018): "raw files" means non-md files, files that are not markdown and not supposed to be parsed like images, text, etc.
Author
Owner

@Nabile-Rahmani commented on GitHub (Apr 15, 2018):

@thehowl Gitea pre-1.4.0 (1.3.2) used to be able to serve any file from a project's wiki, even in subdirectories.
I use wikis in conjunction with mkdocs, and linking to a md source file for editing, but also for storing other documentation file types.

Even though previous versions didn't show the website with the markdown editor, it did serve md files and any other kind of file type present in the wiki repository.
Optionally, it would also be nice if wiki/_pages would recursively search for markdown files, but I don't have a need for it.

I can link you an example if you need it.

@Nabile-Rahmani commented on GitHub (Apr 15, 2018): @thehowl Gitea pre-1.4.0 (1.3.2) used to be able to serve any file from a project's wiki, even in subdirectories. I use wikis in conjunction with mkdocs, and linking to a md source file for editing, but also for storing other documentation file types. Even though previous versions didn't show the website with the markdown editor, it did serve md files and any other kind of file type present in the wiki repository. Optionally, it would also be nice if `wiki/_pages` would recursively search for markdown files, but I don't have a need for it. I can link you an example if you need it.
Author
Owner

@thehowl commented on GitHub (May 3, 2018):

@Nabile-Rahmani sorry about the delay. Hmm, if it did use to work, this seems like an issue then. @lafriks can you please add kind/bug?

@thehowl commented on GitHub (May 3, 2018): @Nabile-Rahmani sorry about the delay. Hmm, if it did use to work, this seems like an issue then. @lafriks can you please add kind/bug?
Author
Owner

@Pablo2048 commented on GitHub (May 11, 2018):

Does this bug have something in common with no images shown in wiki pages please? I'm unable to put any image into wiki pages - it always shows 404 error...

@Pablo2048 commented on GitHub (May 11, 2018): Does this bug have something in common with no images shown in wiki pages please? I'm unable to put any image into wiki pages - it always shows 404 error...
Author
Owner

@thehowl commented on GitHub (May 13, 2018):

@Pablo2048 What do you mean? Even external images?

@thehowl commented on GitHub (May 13, 2018): @Pablo2048 What do you mean? Even external images?
Author
Owner

@Pablo2048 commented on GitHub (May 13, 2018):

@thehowl Thanks for reply - No - it seems like external images works. Internal images (contained inside wiki) return 404.

@Pablo2048 commented on GitHub (May 13, 2018): @thehowl Thanks for reply - No - it seems like external images works. Internal images (contained inside wiki) return 404.
Author
Owner

@thehowl commented on GitHub (May 13, 2018):

Then yes, it's the same issue. Thanks for pitching in!

@thehowl commented on GitHub (May 13, 2018): Then yes, it's the same issue. Thanks for pitching in!
Author
Owner

@stale[bot] commented on GitHub (Jan 27, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 27, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (Feb 7, 2019):

Is this still a problem?

@lunny commented on GitHub (Feb 7, 2019): Is this still a problem?
Author
Owner

@Pablo2048 commented on GitHub (Feb 7, 2019):

Yes - in 1.7.1 the problem persist. It seems like it will be solved in 1.8 - see https://github.com/go-gitea/gitea/issues/4690

@Pablo2048 commented on GitHub (Feb 7, 2019): Yes - in 1.7.1 the problem persist. It seems like it will be solved in 1.8 - see https://github.com/go-gitea/gitea/issues/4690
Author
Owner

@Nabile-Rahmani commented on GitHub (Oct 22, 2019):

Could someone reopen this issue ? I'm still getting 404 errors on 1.9.4.

@Nabile-Rahmani commented on GitHub (Oct 22, 2019): Could someone reopen this issue ? I'm still getting 404 errors on 1.9.4.
Author
Owner

@guillep2k commented on GitHub (Oct 22, 2019):

Could someone reopen this issue ? I'm still getting 404 errors on 1.9.4.

@Nabile-Rahmani I'd suggest you open a new issue, as the cause for your problem is probably different than this'. Please try to give us some information about how it's failing exactly.

@guillep2k commented on GitHub (Oct 22, 2019): > > > Could someone reopen this issue ? I'm still getting 404 errors on 1.9.4. @Nabile-Rahmani I'd suggest you open a new issue, as the cause for your problem is probably different than this'. Please try to give us some information about how it's failing exactly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1540