Skip to content

Fixed robots.txt 404 error - #2226

Merged
appleboy merged 2 commits into
go-gitea:masterfrom
sinnlosername:master
Jul 30, 2017
Merged

Fixed robots.txt 404 error#2226
appleboy merged 2 commits into
go-gitea:masterfrom
sinnlosername:master

Conversation

@sinnlosername

Copy link
Copy Markdown
Contributor

Fixed: #2210

@lunny lunny added this to the 1.2.0 milestone Jul 29, 2017
@lunny lunny added the type/bug label Jul 29, 2017
Comment thread routers/routes/routes.go Outdated
ctx.ServeFileContent(path.Join(setting.CustomPath, "robots.txt"))
} else {
ctx.Error(404)
ctx.Status(404)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not fixing the problem, correct code would be ctx.Handle(404, "", nil)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure? As I looked at other locations in the code where it returns a working 404.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried your code and it still returned empty 404 page

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, changed it!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ctx.Status(404) is used only in API routes

@lafriks

lafriks commented Jul 29, 2017

Copy link
Copy Markdown
Member

LGTM

@bkcsoft bkcsoft added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jul 29, 2017
@appleboy

Copy link
Copy Markdown
Member

LGTM

@bkcsoft bkcsoft added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 30, 2017
@appleboy
appleboy merged commit 27c2dcf into go-gitea:master Jul 30, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

robots.txt 404 should be different

5 participants