diff --git a/services/docextractor/docextractor_test.go b/services/docextractor/docextractor_test.go index 864ebaf2c1..cda8e9fa2d 100644 --- a/services/docextractor/docextractor_test.go +++ b/services/docextractor/docextractor_test.go @@ -105,6 +105,14 @@ func TestExtract(t *testing.T) { []string{}, false, }, + { + "Odt file", + "sample-doc.odt", + ExtractSettings{}, + []string{"simple", "document", "contains"}, + []string{}, + false, + }, { "Pptx file", "sample-doc.pptx", diff --git a/services/docextractor/documents.go b/services/docextractor/documents.go index 91ad5c428b..f67c17fd50 100644 --- a/services/docextractor/documents.go +++ b/services/docextractor/documents.go @@ -5,10 +5,7 @@ package docextractor import ( "errors" - "fmt" "io" - "io/ioutil" - "os" "path" "strings" @@ -41,19 +38,7 @@ func (de *documentExtractor) Extract(filename string, r io.ReadSeeker) (string, return "", errors.New("unknown converter") } - f, err := ioutil.TempFile(os.TempDir(), "docconv") - if err != nil { - return "", fmt.Errorf("error creating temporary file: %v", err) - } - defer f.Close() - defer os.Remove(f.Name()) - - _, err = io.Copy(f, r) - if err != nil { - return "", fmt.Errorf("error copying data into temporary file: %v", err) - } - - text, _, err := converter(f) + text, _, err := converter(r) if err != nil { return "", err }