Skip to content

When soffice fails to process a file, an error other than a PreviewError is raised #34

@rbclark

Description

@rbclark

I have a few docx files which are causing soffice to return an Unspecified Application Error. When this occurs, the gem still attempts to open the temporary file even though it was never created:

Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/ActiveStorage-filename.png (Errno::ENOENT)
  activestorage-office-previewer (0.1.2) lib/active_storage/previewer/office_previewer.rb:49:in `initialize'
  activestorage-office-previewer (0.1.2) lib/active_storage/previewer/office_previewer.rb:49:in `open'
  activestorage-office-previewer (0.1.2) lib/active_storage/previewer/office_previewer.rb:49:in `consume'
  activestorage-office-previewer (0.1.2) lib/active_storage/previewer/office_previewer.rb:45:in `draw_poster_image_from'
  activestorage-office-previewer (0.1.2) lib/active_storage/previewer/office_previewer.rb:35:in `block in preview'
...
(102 additional frame(s) were not displayed)

We've traced this down to an error occurring where soffice is crashing trying to generate a preview

javaldx: Could not find a Java Runtime Environment!
Warning: failed to read path from javaldx
convert /tmp/ActiveStorage-filename.docx as a Writer document -> /tmp/ActiveStorage-filename.png using filter : writer_png_Export
Unspecified Application Error

Based on my understanding of ActiveStorage Previewers, when a file fails to be processed it should raise an PreviewError instead of this error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions