diff --git a/app/file.go b/app/file.go index 9d7a382563..12c954de33 100644 --- a/app/file.go +++ b/app/file.go @@ -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") diff --git a/app/file_test.go b/app/file_test.go index d234e5eb83..6f84894b8f 100644 --- a/app/file_test.go +++ b/app/file_test.go @@ -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)) +}