Commit f7b90c8b authored by Lev's avatar Lev Committed by Hanzei

Fixed error message displayed for FileWillBeUploaded rejections (#10535)

#### Summary
Fixed the error message displayed when an uploading file gets rejected by a plugin's FileWillBeUploaded hook.

#### Ticket Link
https://mattermost.atlassian.net/browse/MM-14803
parent 120c9604
......@@ -648,8 +648,8 @@ func (t *uploadFileTask) runPlugins() *model.AppError {
replacementInfo, rejectionReason := hooks.FileWillBeUploaded(pluginContext,
t.fileinfo, t.newReader(), buf)
if rejectionReason != "" {
rejectionError = t.newAppError("api.file.upload_file.read_request.app_error",
rejectionReason, http.StatusBadRequest)
rejectionError = t.newAppError("api.file.upload_file.rejected_by_plugin.app_error",
rejectionReason, http.StatusForbidden, "Reason", rejectionReason)
return false
}
if replacementInfo != nil {
......
......@@ -1252,6 +1252,10 @@
"id": "api.file.upload_file.too_large_detailed.app_error",
"translation": "Unable to upload file {{.Filename}}. {{.Length}} bytes exceeds the maximum allowed {{.Limit}} bytes."
},
{
"id": "api.file.upload_file.rejected_by_plugin.app_error",
"translation": "Unable to upload file {{.Filename}}. Rejected by plugin: {{.Reason}}"
},
{
"id": "api.file.write_file.s3.app_error",
"translation": "Encountered an error writing to S3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment