Skip to content

Commit

Permalink
fix: removed error from artifact server 401 response. Fixes #8382 (#8383
Browse files Browse the repository at this point in the history
)

Signed-off-by: Rohan Kumar <rohankmr414@gmail.com>
  • Loading branch information
rohankmr414 authored Apr 12, 2022
1 parent 2d91646 commit 95323f8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions server/artifacts/artifact_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (a *ArtifactServer) getArtifact(w http.ResponseWriter, r *http.Request, isI

ctx, err := a.gateKeeping(r, types.NamespaceHolder(namespace))
if err != nil {
a.unauthorizedError(err, w)
a.unauthorizedError(w)
return
}

Expand Down Expand Up @@ -114,14 +114,14 @@ func (a *ArtifactServer) getArtifactByUID(w http.ResponseWriter, r *http.Request

ctx, err := a.gateKeeping(r, types.NamespaceHolder(wf.GetNamespace()))
if err != nil {
a.unauthorizedError(err, w)
a.unauthorizedError(w)
return
}

// return 401 if the client does not have permission to get wf
err = a.validateAccess(ctx, wf)
if err != nil {
a.unauthorizedError(err, w)
a.unauthorizedError(w)
return
}

Expand Down Expand Up @@ -150,9 +150,8 @@ func (a *ArtifactServer) gateKeeping(r *http.Request, ns types.NamespacedRequest
return a.gatekeeper.ContextWithRequest(ctx, ns)
}

func (a *ArtifactServer) unauthorizedError(err error, w http.ResponseWriter) {
func (a *ArtifactServer) unauthorizedError(w http.ResponseWriter) {
w.WriteHeader(401)
_, _ = w.Write([]byte(err.Error()))
}

func (a *ArtifactServer) serverInternalError(err error, w http.ResponseWriter) {
Expand Down

0 comments on commit 95323f8

Please sign in to comment.