[MM-56792] Clarify large plugin upload error (#26271)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Этот коммит содержится в:
@@ -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
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user