Plugins: Avoid returning 404 for AutoEnabled apps (#93436)

avoid errors for autoenabled apps
This commit is contained in:
Will Browne
2024-09-19 14:00:34 +01:00
committed by GitHub
parent d5f205fdef
commit 362ffff591
2 changed files with 13 additions and 1 deletions
+7 -1
View File
@@ -28,7 +28,13 @@ func checkAppEnabled(pluginStore pluginstore.Store, pluginSettings pluginsetting
})
if err != nil {
if errors.Is(err, pluginsettings.ErrPluginSettingNotFound) {
c.JsonApiErr(http.StatusNotFound, "Plugin not found", nil)
// If the plugin is auto enabled, we don't want to return an error because auto enabling allows us
// to enable plugins that are not explicitly configured.
if p.AutoEnabled {
return
}
c.JsonApiErr(http.StatusNotFound, "Plugin setting not found", nil)
return
}
c.JsonApiErr(http.StatusInternalServerError, "Failed to get plugin settings", err)