[v11.2.x] Plugins: Avoid returning 404 for AutoEnabled apps (#93488)
Plugins: Avoid returning 404 for `AutoEnabled` apps (#93436)
avoid errors for autoenabled apps
(cherry picked from commit 362ffff591)
Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
co-authored by
Will Browne
parent
1c7ac3ba1a
commit
7ca022d2a7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user