Skip to content

Commit

Permalink
Fix UI crash when event ID is custom (#1201)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodoldneon committed Mar 5, 2024
1 parent 8ad3229 commit 1199d96
Show file tree
Hide file tree
Showing 13 changed files with 128 additions and 328 deletions.
13 changes: 11 additions & 2 deletions pkg/coreapi/coreapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,24 @@ func (a CoreAPI) EventRuns(w http.ResponseWriter, r *http.Request) {
// NOTE: In development this does no authentication. This must check API keys
// in self-hosted and production environments.
ctx := r.Context()
eventID := chi.URLParam(r, "eventID")
if eventID == "" {
eventIDStr := chi.URLParam(r, "eventID")
if eventIDStr == "" {
_ = publicerr.WriteHTTP(w, publicerr.Error{
Status: 400,
Message: "No event ID found",
})
return
}

eventID, err := ulid.Parse(eventIDStr)
if err != nil {
_ = publicerr.WriteHTTP(w, publicerr.Error{
Status: 400,
Message: "Event ID is not a valid ULID",
Err: err,
})
}

runs, err := a.tracker.Runs(ctx, eventID)
if err != nil {
_ = publicerr.WriteHTTP(w, publicerr.Error{
Expand Down
227 changes: 72 additions & 155 deletions pkg/coreapi/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions pkg/coreapi/gql.query.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ type Query {

# Get an individual function run
functionRun(query: FunctionRunQuery!): FunctionRun

# Get all function runs
functionRuns(query: FunctionRunsQuery!): [FunctionRun!]
}

input ActionVersionQuery {
Expand Down
Loading

0 comments on commit 1199d96

Please sign in to comment.