From a2ab7e6519303171bbe1c04aa4f06dafc95e68f7 Mon Sep 17 00:00:00 2001 From: Jake Howell Date: Sun, 8 Feb 2026 23:21:43 +1100 Subject: [PATCH] fix: marshal `OAuth2ProviderApp` into `[]` not `null` (#21992) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pull-request makes it so that when we `json.Marshal` an empty set of responses from `ListApps(...)` we return an empty array (`[]`) instead of `null`. This ensures that the array is non-nil 🙂 | Old | New | | --- | --- | | OAUTH2_APPS_BORKED | OAUTH2_APPS_WORKING | --- coderd/oauth2provider/apps.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coderd/oauth2provider/apps.go b/coderd/oauth2provider/apps.go index c94b5fc538..b25b0f91e8 100644 --- a/coderd/oauth2provider/apps.go +++ b/coderd/oauth2provider/apps.go @@ -50,7 +50,7 @@ func ListApps(db database.Store, accessURL *url.URL) http.HandlerFunc { return } - var sdkApps []codersdk.OAuth2ProviderApp + sdkApps := make([]codersdk.OAuth2ProviderApp, 0, len(userApps)) for _, app := range userApps { sdkApps = append(sdkApps, db2sdk.OAuth2ProviderApp(accessURL, app.OAuth2ProviderApp)) }