From d7b3f5de12f6341f7ee1ddfbcc1e8ca9f9cbe742 Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Wed, 6 Nov 2024 19:05:41 +1100 Subject: [PATCH] Signed-off-by: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> --- server/artifacts/artifact_server.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/server/artifacts/artifact_server.go b/server/artifacts/artifact_server.go index 70ab05683768..a0bc9901c784 100644 --- a/server/artifacts/artifact_server.go +++ b/server/artifacts/artifact_server.go @@ -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") @@ -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) @@ -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) @@ -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)