diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-02-09 13:51:44 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-02-09 13:51:44 +0100 |
commit | ddc7af9a53fb78a363c21043ab0e2e1a80b48750 (patch) | |
tree | 4965eb6707eb15ab5109b7d19986154e9b704489 /lib/files/view.php | |
parent | 0c73cae77b402355809c8f5f5be69d8a730fe3e2 (diff) | |
download | nextcloud-server-ddc7af9a53fb78a363c21043ab0e2e1a80b48750.tar.gz nextcloud-server-ddc7af9a53fb78a363c21043ab0e2e1a80b48750.zip |
know your libraries ;-)
strrpos fails in cases the file in the path has no dot but the parent folder
Diffstat (limited to 'lib/files/view.php')
-rw-r--r-- | lib/files/view.php | 6 |
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; |