aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/preview
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-03-26 23:08:08 +0100
committerVincent Petry <pvince81@owncloud.com>2015-03-26 23:08:08 +0100
commit746be98e0387ea138c4413fb89ad7e9ee87ce7aa (patch)
tree96decc89487fed61b0a111e4d630cf668c615c99 /lib/private/preview
parentd082e37270f19269cd13098cb013c8543f4a1843 (diff)
parentf890c3ffb1b7f7f1b744b37426993010e0c39138 (diff)
downloadnextcloud-server-746be98e0387ea138c4413fb89ad7e9ee87ce7aa.tar.gz
nextcloud-server-746be98e0387ea138c4413fb89ad7e9ee87ce7aa.zip
Merge pull request #13654 from oparoz/tmpfile-with-extension
Keep the extension in temp files
Diffstat (limited to 'lib/private/preview')
-rw-r--r--lib/private/preview/office.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index b97c29f50ba..54c0c26c079 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -45,12 +45,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;
}
@@ -59,7 +63,7 @@ abstract class Office extends Provider {
$image->loadFromData($pdf);
unlink($absPath);
- unlink($absPath . '.pdf');
+ unlink($pdfPreview);
return $image->valid() ? $image : false;
}