* MM-38982: fixes SVG uploading

Uploading SVG files was "almost" treated like an image in some places,
resulting in not showing the SVG on the client.
This is happening because when we fail to generate a mini preview for an
image, we prepend "invalid-" to the MimeType.

This commit adds a check to guard against SVG files in methods that make
no sense for SVGs.

* Reverts invalid-{mimetype} fix

* Uses fileInfo.IsSvg() where it can
Этот коммит содержится в:
Kyriakos Z
2022-05-20 17:26:21 +03:00
коммит произвёл GitHub
родитель 2a9f78536f
Коммит 9a67ae9ac6
5 изменённых файлов: 12 добавлений и 17 удалений

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

@@ -263,7 +263,7 @@ func (a *App) UploadData(c *request.Context, us *model.UploadSession, rd io.Read
}
// image post-processing
if info.IsImage() {
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)