Fall back to avaiable scope if scope is invalid
On environments, only 2 scopes are valid: available and stopped. If an invalid scope is passed via the query params, the controller attempted to use it and would return a 500 error. This behaviour is still useful for the JSON API, and so we only fetch the environments if the format is JSON. However, as the environments are fetched via API after the HTML is returned, there's no need to query the environments when the format is HTML, meaning no need to use the scope. This stops invalid query params (like ?scope=foo) from returning a 500 error. To stop the resultant API calls from failing, we can check to see if the requested scope is valid. If it is not, default to the available scope. Changelog: fixed
Showing
Please register or sign in to comment