коммит произвёл
GitHub
родитель
b45ff0be5d
Коммит
717a4d04a9
@@ -47,7 +47,7 @@ func (a *App) runPluginsHook(c *request.Context, info *model.FileInfo, file io.R
|
||||
newInfo, rejStr := hooks.FileWillBeUploaded(pluginContext, info, file, w)
|
||||
if rejStr != "" {
|
||||
rejErr = model.NewAppError("runPluginsHook", "app.upload.run_plugins_hook.rejected",
|
||||
map[string]interface{}{"Filename": info.Name, "Reason": rejStr}, "", http.StatusBadRequest)
|
||||
map[string]any{"Filename": info.Name, "Reason": rejStr}, "", http.StatusBadRequest)
|
||||
return false
|
||||
}
|
||||
if newInfo != nil {
|
||||
@@ -102,7 +102,7 @@ func (a *App) runPluginsHook(c *request.Context, info *model.FileInfo, file io.R
|
||||
func (a *App) CreateUploadSession(us *model.UploadSession) (*model.UploadSession, *model.AppError) {
|
||||
if us.FileSize > *a.Config().FileSettings.MaxFileSize {
|
||||
return nil, model.NewAppError("CreateUploadSession", "app.upload.create.upload_too_large.app_error",
|
||||
map[string]interface{}{"channelId": us.ChannelId}, "", http.StatusRequestEntityTooLarge)
|
||||
map[string]any{"channelId": us.ChannelId}, "", http.StatusRequestEntityTooLarge)
|
||||
}
|
||||
|
||||
us.FileOffset = 0
|
||||
@@ -121,11 +121,11 @@ func (a *App) CreateUploadSession(us *model.UploadSession) (*model.UploadSession
|
||||
channel, err := a.GetChannel(us.ChannelId)
|
||||
if err != nil {
|
||||
return nil, model.NewAppError("CreateUploadSession", "app.upload.create.incorrect_channel_id.app_error",
|
||||
map[string]interface{}{"channelId": us.ChannelId}, "", http.StatusBadRequest)
|
||||
map[string]any{"channelId": us.ChannelId}, "", http.StatusBadRequest)
|
||||
}
|
||||
if channel.DeleteAt != 0 {
|
||||
return nil, model.NewAppError("CreateUploadSession", "app.upload.create.cannot_upload_to_deleted_channel.app_error",
|
||||
map[string]interface{}{"channelId": us.ChannelId}, "", http.StatusBadRequest)
|
||||
map[string]any{"channelId": us.ChannelId}, "", http.StatusBadRequest)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ func (a *App) UploadData(c *request.Context, us *model.UploadSession, rd io.Read
|
||||
errStr = err.Error()
|
||||
}
|
||||
return nil, model.NewAppError("UploadData", "app.upload.upload_data.first_part_too_small.app_error",
|
||||
map[string]interface{}{"Size": minFirstPartSize}, errStr, http.StatusBadRequest)
|
||||
map[string]any{"Size": minFirstPartSize}, errStr, http.StatusBadRequest)
|
||||
}
|
||||
} else if us.FileOffset < us.FileSize {
|
||||
// resume upload
|
||||
@@ -266,7 +266,7 @@ func (a *App) UploadData(c *request.Context, us *model.UploadSession, rd io.Read
|
||||
if info.IsImage() && !info.IsSvg() {
|
||||
if limitErr := checkImageResolutionLimit(info.Width, info.Height, *a.Config().FileSettings.MaxImageResolution); limitErr != nil {
|
||||
return nil, model.NewAppError("uploadData", "app.upload.upload_data.large_image.app_error",
|
||||
map[string]interface{}{"Filename": us.Filename, "Width": info.Width, "Height": info.Height}, "", http.StatusBadRequest)
|
||||
map[string]any{"Filename": us.Filename, "Width": info.Width, "Height": info.Height}, "", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
nameWithoutExtension := info.Name[:strings.LastIndex(info.Name, ".")]
|
||||
|
||||
Ссылка в новой задаче
Block a user