mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-21572] Disable InstallFromUrl if EnableUploads is false (#13636)
* Disable InstallFromUrl if EnableUploads is false * Break into 3 seperate lines Co-authored-by: mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
@@ -85,7 +85,9 @@ func uploadPlugin(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func installPluginFromUrl(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
if !*c.App.Config().PluginSettings.Enable || *c.App.Config().PluginSettings.RequirePluginSignature {
|
||||
if !*c.App.Config().PluginSettings.Enable ||
|
||||
*c.App.Config().PluginSettings.RequirePluginSignature ||
|
||||
!*c.App.Config().PluginSettings.EnableUploads {
|
||||
c.Err = model.NewAppError("installPluginFromUrl", "app.plugin.disabled.app_error", nil, "", http.StatusNotImplemented)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -145,6 +145,9 @@ func TestPlugin(t *testing.T) {
|
||||
_, resp = th.SystemAdminClient.UploadPlugin(bytes.NewReader(tarData))
|
||||
CheckNotImplementedStatus(t, resp)
|
||||
|
||||
_, resp = th.SystemAdminClient.InstallPluginFromUrl(url, false)
|
||||
CheckNotImplementedStatus(t, resp)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.PluginSettings.EnableUploads = true })
|
||||
_, resp = th.Client.UploadPlugin(bytes.NewReader(tarData))
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
Reference in New Issue
Block a user