-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Pull request overview page getting 404 (?repo=) #5892
Comments
|
@zeripath That route actually exists gitea/routers/routes/routes.go Line 188 in 2569363
|
I was following this bug on Discord but it's past 12am here and I am exhausted, could have tested and sent a fix potentially |
Ugh my bad. I just scanned that file and missed that ... It's past 11 here too so won't be able to look at it myself further. |
Go get some rest you two! |
Line 150 in 2569363
|
Do you actually have a repository with an By the way, I think it is better we return a 404 in this instance rather than a 500 |
I just checked and the repo id of the repo is indeed 9. So trying to open |
Sorry @ntimo . Just looking at your screenshots the likely place you're getting the 404 from is: https://github.com/go-gitea/gitea/blob/v1.7.0/routers/user/home.go#L296 That line sets the status as 404 without sending the gitea 404 page. So it seems that the ctxUser doesn't have permission to read that repository... This is odd. |
@zeripath Thanks for reopening. But why would the ctxUser not have permissions to read the repo? I created it with my user and its also in my namespace ntimo/reponame. Also I can commits code changes, create pull requests, etc in this repo. |
I'm not sure. That line is the only place that the 404 could be set. (It's also wrong - we should never just set a status of 404 without sending the 404 page!) Looking at the code leading to that point I can't quite see what the problem could be - I don't think it's the clearest code but I'm not certain it's definitely wrong. The only thing I can think of is that the internal cache on line is incorrect somehow and the repo returned on https://github.com/go-gitea/gitea/blob/master/routers/user/home.go#L300 is wrong. Can you reproduce your problem on try or give me a script of exactly what to do to replicate it? |
I can't replicate it on try. Well the steps I follow to reproduce the issue on my installation are quite simple:
Then it opens the url: |
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. |
@ntimo can you still reproduce it on v1.7.5? |
@lunny I am using 1.8.0-rc2 at the moment and I can still reproduce it :( |
|
We're experiencing the same issue with the version 1.9.4. |
@Ahaus314 This can happen if the repository is private and you somehow lost the session, e.g. you save a link for later, then open the browser and try to use the link without getting logged in first. If that's not your case, please:
|
@guillep2k Thanks for the reply and sorry for the delay. This behavior still happen with v1.10.0.
|
@Ahaus314 In my company I have 1.10.0 with a setting at first glance similar to yours but I can't reproduce, so there must be some subtle difference. I'm assuming that the user in the example you've detailed doesn't have an expired session (i.e. it's a recent login), so let's put that aside. I'm suspecting there's some specific combination of permissions that leads to this problem, but I can't imagine what is it. In my case all repos are private by site policy, so there's that, but I've tested the following scenarios:
In all cases the user was either able to navigate normally or the repo wasn't listed at all (i.e. the user had not enough permissions). Maybe the list above will give you some ideas to try yourself or some insight about the problem that could help us find it. |
As well, it seems some logging has been added to the spot @zeripath mentioned up above where a 404 status is set without a page. For reference on the |
@guillep2k I"m pretty sure I already did those tests (I did a lot and cannot remember), but to be sure, I'll do those. I highly think it's a permission related issue. As @jolheiser said, some logging was added and I remember seeing those "Permission denied" messages in the log. @jolheiser I already setup a dev environment which is an exact replica from the prod environment. So I can do any tests without impacting the prod. I already changed the log level to trace on that instance. I'll join some log next week when I'll get back to office. Thanks for your help! |
Maybe https://github.com/go-gitea/gitea/blob/v1.7.0/routers/user/home.go#L290 should be -perm, err := models.GetUserRepoPermission(repo, ctxUser)
+perm, err := models.GetUserRepoPermission(repo, ctx.User) but not the login user. |
With recent PRs this behavior has changed. However there are some small problems left: Small nit in routers/user/home.go:313:
The check is always for unit type issues also for pull request page. Maybe the repository should also be filtered out and not be displayed in this case? Currently you only see repositories where you are a team member, not repositories where you are collaborator of. Shouldn't the database query use the access table instead? |
Here's the log when I try to access the Pull Request from the top menu. Thanks! |
This should be a different problem with the original. |
@Ahaus314 That is on 1.10? |
I just checked, and yes, it's still on 1.10.0. |
#8741 is towards 1.11, so the 404 problem shall be solved there. I think there are some other problems remaining with that page, not all PRs is included as expected. |
I'll close this since original issue is solved, and mentioned other issues should be too ... ... if not pleace open new issues for them |
[x]
):Description
When I go to
mygitea.com/pulls?type=all&repo=9&sort=&state=open
I get a white page in Safari, Chrome simply shows the Chrome 404 page. When I change the ?repo= to be 0 it works and shows the correct repo. All other repos work fine. When I go to the Pull-Request page in the top menu and I select this one repo that is in my namespace I get this crazy error, but all other repos work fine.No custom 404 Gitea page is shown.
Log
Screenshots
The text was updated successfully, but these errors were encountered: