Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed robots.txt 404 error #2226

Merged
merged 2 commits into from
Jul 30, 2017
Merged

Fixed robots.txt 404 error #2226

merged 2 commits into from
Jul 30, 2017

Conversation

sinnlosername
Copy link
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
@@ -651,7 +651,7 @@ func RegisterRoutes(m *macaron.Macaron) {
if setting.HasRobotsTxt {
ctx.ServeFileContent(path.Join(setting.CustomPath, "robots.txt"))
} else {
ctx.Error(404)
ctx.Status(404)
Copy link
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
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
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
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
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
Copy link
Member

lafriks commented Jul 29, 2017

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
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