From 60b1643f02a2588d90fa77346bc377f5c1db8fbe Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Sun, 25 Jan 2015 19:05:30 +0100 Subject: Fix the office class The office converter already replaces the original extension with '.pdf', so we need to switch the extensions of the tmp file instead of appending '.pdf' to it --- lib/private/preview/office.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/private/preview') diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php index 5bd61bde3be..1f6d977ade4 100644 --- a/lib/private/preview/office.php +++ b/lib/private/preview/office.php @@ -31,12 +31,16 @@ abstract class Office extends Provider { shell_exec($exec); //create imagick object from pdf + $pdfPreview = null; try{ - $pdf = new \imagick($absPath . '.pdf' . '[0]'); + list( $dirname, , , $filename ) = array_values( pathinfo($absPath) ); + $pdfPreview = $dirname . '/' . $filename . '.pdf'; + + $pdf = new \imagick($pdfPreview . '[0]'); $pdf->setImageFormat('jpg'); } catch (\Exception $e) { unlink($absPath); - unlink($absPath . '.pdf'); + unlink($pdfPreview); \OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); return false; } @@ -45,7 +49,7 @@ abstract class Office extends Provider { $image->loadFromData($pdf); unlink($absPath); - unlink($absPath . '.pdf'); + unlink($pdfPreview); return $image->valid() ? $image : false; } -- cgit v1.2.3