MM-45871: Do not try to extract content from images (#20698)

This creates faulty requests to Bifrost and results in
errors and warnings in the logs. Even without Bifrost,
this would make unnecessary requests to S3.

We only extract info from documents and therefore we can
safely avoid this.

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2022-07-26 12:17:23 +05:30
коммит произвёл GitHub
родитель 77881fc357
Коммит 7441a26b6d
2 изменённых файлов: 15 добавлений и 0 удалений

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

@@ -1327,6 +1327,11 @@ func (a *App) SearchFilesInTeamForUser(c *request.Context, terms string, userId
}
func (a *App) ExtractContentFromFileInfo(fileInfo *model.FileInfo) error {
// We don't process images.
if fileInfo.IsImage() {
return nil
}
file, aerr := a.FileReader(fileInfo.Path)
if aerr != nil {
return errors.Wrap(aerr, "failed to open file for extract file content")

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

@@ -543,3 +543,13 @@ func TestSearchFilesInTeamForUser(t *testing.T) {
es.AssertExpectations(t)
})
}
func TestExtractContentFromFileInfo(t *testing.T) {
app := &App{}
fi := &model.FileInfo{
MimeType: "image/jpeg",
}
// Test that we don't process images.
require.NoError(t, app.ExtractContentFromFileInfo(fi))
}