Skip to content

Commit

Permalink
Add a 404 rule for workflows
Browse files Browse the repository at this point in the history
Send back 404 if there's a workflow ID in the URL and it isn't an active workflow.
  • Loading branch information
eatyourgreens committed Jan 25, 2021
1 parent 256de60 commit c5feb81
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ export default async function getDefaultPageProps({ params, query, req, res }) {
}
}

const workflowExists = store.project.links.active_workflows.includes(params.workflowID)
if (params.workflowID && !workflowExists) {
res.statusCode = 404
return {
props: {
statusCode: 404,
title: `Workflow ${params.workflowID} was not found.`
}
}
}

const { project, ui } = getSnapshot(store)
const { headers, connection } = req
const { env } = query
Expand Down

0 comments on commit c5feb81

Please sign in to comment.