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

fix: nilpointer in get artifacts. Fixes: #12542 #13869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions server/artifacts/artifact_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ func (a *ArtifactServer) GetArtifactFile(w http.ResponseWriter, r *http.Request)
a.serverInternalError(err, w)
return
}

if wf == nil {
a.httpBadRequestError(w)
return
}
case "archived-workflows":
uid := id
log.WithFields(log.Fields{"namespace": namespace, "uid": uid, "nodeId": nodeId, "artifactName": artifactName}).Info("Get artifact file")
Expand All @@ -137,6 +142,11 @@ func (a *ArtifactServer) GetArtifactFile(w http.ResponseWriter, r *http.Request)
return
}

if wf == nil {
a.httpBadRequestError(w)
return
}

// check that the namespace passed in matches this workflow's namespace
if wf.GetNamespace() != namespace {
a.httpBadRequestError(w)
Expand Down Expand Up @@ -266,6 +276,10 @@ func (a *ArtifactServer) getArtifact(w http.ResponseWriter, r *http.Request, isI
a.httpFromError(err, w)
return
}
if wf == nil {
a.httpBadRequestError(w)
return
}
art, driver, err := a.getArtifactAndDriver(ctx, nodeId, artifactName, isInput, wf, nil)
if err != nil {
a.serverInternalError(err, w)
Expand Down Expand Up @@ -305,6 +319,11 @@ func (a *ArtifactServer) getArtifactByUID(w http.ResponseWriter, r *http.Request
return
}

if wf == nil {
a.httpBadRequestError(w)
return
}

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