summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/files/view.php6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/files/view.php b/lib/files/view.php
index dfcb770328b..1a234228eab 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -509,11 +509,7 @@ class View {
if (Filesystem::isValidPath($path)) {
$source = $this->fopen($path, 'r');
if ($source) {
- $extension = '';
- $extOffset = strpos($path, '.');
- if ($extOffset !== false) {
- $extension = substr($path, strrpos($path, '.'));
- }
+ $extension = pathinfo($path, PATHINFO_EXTENSION);
$tmpFile = \OC_Helper::tmpFile($extension);
file_put_contents($tmpFile, $source);
return $tmpFile;