Skip to content

libreoffice document preview #17864

@A-Barta

Description

@A-Barta

hello,
when creating previews of libreoffice documents I get the following error:
unlink(/var/local/nextcloud/data/Myname/files/myfile.png): No such file or directory at /usr/share/webapps/nextcloud/lib/private/Preview/Office.php#65

I did some digging and found two problems:

  1. libreoffice needs a home folder to run, even headless, as it creates some .config files; but my http user didn't have one. I fixed it by adding
    putenv('HOME=' . $tmpDir);
    in .../lib/private/Preview/Office.php, before line 53

  2. the output folder of the conversion to png is $tmpDir (see .../lib/private/Preview/Office.php, line 51) while the previewer looks for the png file in $dirname. So I changed
    $pngPreview = $dirname . '/' . $filename . '.png';
    to:
    $pngPreview = $tmpDir . '/' . $filename . '.png';
    in .../lib/private/Preview/Office.php line 59.

This solved my problem, but I am not sure if it's a good fix, especially the first part.

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions