[MM-56792] Clarify large plugin upload error (#26271)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
daveseo901
2024-09-09 08:00:25 -04:00
коммит произвёл GitHub
родитель f8c0035c82
Коммит 388dfdfbca
4 изменённых файлов: 29 добавлений и 2 удалений

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

@@ -20,7 +20,8 @@ import (
)
const (
MaximumPluginFileSize = 50 * 1024 * 1024
// MaxPluginMemory is the maximum number of bytes to hold in memory when reading a plugin bundle.
MaxPluginMemory = 50 * 1024 * 1024
)
func (api *API) InitPlugin() {
@@ -57,7 +58,11 @@ func uploadPlugin(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
if err := r.ParseMultipartForm(MaximumPluginFileSize); err != nil {
if err := r.ParseMultipartForm(MaxPluginMemory); err != nil {
if err.Error() == "http: request body too large" {
c.Err = model.NewAppError("uploadPlugin", "api.plugin.upload.file_too_large.app_error", nil, "", http.StatusRequestEntityTooLarge)
return
}
http.Error(w, err.Error(), http.StatusBadRequest)
return
}