aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2020-06-19 00:35:56 +0100
committerMichael Muré <batolettre@gmail.com>2020-06-27 23:01:10 +0200
commit5f72b04ef8e84b1c367ca6874519706318e351f5 (patch)
tree6f73279d05130d3d6d83de1dad3a5b4ac25be080 /commands
parente5a316e40c377a8563e92f62b0773ed34321a91a (diff)
downloadgit-bug-5f72b04ef8e84b1c367ca6874519706318e351f5.tar.gz
Use ErrNotAuthenticated
Diffstat (limited to 'commands')
-rw-r--r--commands/webui.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/commands/webui.go b/commands/webui.go
index 90679c79..c07f74fd 100644
--- a/commands/webui.go
+++ b/commands/webui.go
@@ -211,13 +211,13 @@ func newGitUploadFileHandler(repo repository.Repo) http.Handler {
}
func (gufh *gitUploadFileHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
- id, err := graphqlidentity.ForContextUncached(r.Context(), gufh.repo)
- if err != nil {
- http.Error(rw, fmt.Sprintf("loading identity: %v", err), http.StatusInternalServerError)
- return
- } else if id == nil {
+ _, err := graphqlidentity.ForContextUncached(r.Context(), gufh.repo)
+ if err == graphqlidentity.ErrNotAuthenticated {
http.Error(rw, fmt.Sprintf("read-only mode or not logged in"), http.StatusForbidden)
return
+ } else if err != nil {
+ http.Error(rw, fmt.Sprintf("loading identity: %v", err), http.StatusInternalServerError)
+ return
}
// 100MB (github limit)