MM-51786: Sentry crash while installing a blocked plugin (#22804)
We would return "nil, nil" if a plugin was on the blocklist. This would cause a nil dereference panic while trying to add struct fields from manifest to the audit logs. To avoid it, we return an error explicitly and ignore the error ids to unnecessarily have it log an error. https://mattermost.atlassian.net/browse/MM-51786 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
aca9553df1
Коммит
470e4c9d66
@@ -172,10 +172,9 @@ func TestInstallPluginLocally(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
cleanExistingBundles(t, th)
|
||||
|
||||
manifest, appErr := installPlugin(t, th, "playbooks", "0.0.1", installPluginLocallyAlways)
|
||||
require.Nil(t, appErr)
|
||||
require.Nil(t, manifest)
|
||||
|
||||
_, appErr := installPlugin(t, th, "playbooks", "0.0.1", installPluginLocallyAlways)
|
||||
require.NotNil(t, appErr)
|
||||
require.Equal(t, "app.plugin.blocked.app_error", appErr.Id)
|
||||
assertBundleInfoManifests(t, th, []*model.Manifest{})
|
||||
})
|
||||
|
||||
@@ -222,9 +221,9 @@ func TestInstallPluginLocally(t *testing.T) {
|
||||
require.Nil(t, appErr)
|
||||
require.NotNil(t, existingManifest)
|
||||
|
||||
manifest, appErr := installPlugin(t, th, "valid", "0.0.1", installPluginLocallyOnlyIfNewOrUpgrade)
|
||||
require.Nil(t, appErr)
|
||||
require.Nil(t, manifest)
|
||||
_, appErr = installPlugin(t, th, "valid", "0.0.1", installPluginLocallyOnlyIfNewOrUpgrade)
|
||||
require.NotNil(t, appErr)
|
||||
require.Equal(t, "app.plugin.skip_installation.app_error", appErr.Id)
|
||||
|
||||
assertBundleInfoManifests(t, th, []*model.Manifest{existingManifest})
|
||||
})
|
||||
@@ -238,9 +237,9 @@ func TestInstallPluginLocally(t *testing.T) {
|
||||
require.Nil(t, appErr)
|
||||
require.NotNil(t, existingManifest)
|
||||
|
||||
manifest, appErr := installPlugin(t, th, "valid", "0.0.2", installPluginLocallyOnlyIfNewOrUpgrade)
|
||||
require.Nil(t, appErr)
|
||||
require.Nil(t, manifest)
|
||||
_, appErr = installPlugin(t, th, "valid", "0.0.2", installPluginLocallyOnlyIfNewOrUpgrade)
|
||||
require.NotNil(t, appErr)
|
||||
require.Equal(t, "app.plugin.skip_installation.app_error", appErr.Id)
|
||||
|
||||
assertBundleInfoManifests(t, th, []*model.Manifest{existingManifest})
|
||||
})
|
||||
|
||||
Ссылка в новой задаче
Block a user