Save access on plugin env during ServePluginPublicRequest (#16854)

* Save access on plugin env during ServePluginPublicRequest

* Cover solution with the offending specs

* Apply PR suggestions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
John Tzikas
2021-02-17 12:23:30 +02:00
коммит произвёл GitHub
родитель 46b4987873
Коммит 8e71ab1ecb
2 изменённых файлов: 57 добавлений и 1 удалений

Просмотреть файл

@@ -89,7 +89,15 @@ func (a *App) ServePluginPublicRequest(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
pluginID := vars["plugin_id"]
publicFilesPath, err := a.GetPluginsEnvironment().PublicFilesPath(pluginID)
pluginsEnv := a.GetPluginsEnvironment()
// Check if someone has nullified the pluginsEnv in the meantime
if pluginsEnv == nil {
http.NotFound(w, r)
return
}
publicFilesPath, err := pluginsEnv.PublicFilesPath(pluginID)
if err != nil {
http.NotFound(w, r)
return