Return 404 instead of 403 if user can not access the repo (#23155) (#23158)

Backport #23155

Fixes https://github.com/go-gitea/gitea/issues/23150

Before:

![image](https://user-images.githubusercontent.com/18380374/221390802-2317c6bc-d163-4def-b68b-6bb297143fe2.png)

After:

![image](https://user-images.githubusercontent.com/18380374/221390823-87490351-39c3-4a40-b1d2-11fc5b85fa24.png)

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Yarden Shoham 2023-02-26 14:20:44 +02:00 committed by GitHub
parent 27879bc45e
commit 1bc4ffc337
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -228,7 +228,7 @@ func httpBase(ctx *context.Context) (h *serviceHandler) {
} }
if !p.CanAccess(accessMode, unitType) { if !p.CanAccess(accessMode, unitType) {
ctx.PlainText(http.StatusForbidden, "User permission denied") ctx.PlainText(http.StatusNotFound, "Repository not found")
return return
} }
} }