]> source.dussan.org Git - nextcloud-server.git/commitdiff
know your libraries ;-)
authorThomas Müller <thomas.mueller@tmit.eu>
Sat, 9 Feb 2013 12:51:44 +0000 (13:51 +0100)
committerThomas Müller <thomas.mueller@tmit.eu>
Sat, 9 Feb 2013 12:51:44 +0000 (13:51 +0100)
strrpos fails in cases the file in the path has no dot but the parent folder

lib/files/view.php

index dfcb770328bd4dd6161708ee64d47b00095bec53..1a234228eab34c4370effa6d98fe8c63baea0291 100644 (file)
@@ -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;