summaryrefslogtreecommitdiffstats
path: root/lib/files/view.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-02-09 13:51:44 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2013-02-09 13:51:44 +0100
commitddc7af9a53fb78a363c21043ab0e2e1a80b48750 (patch)
tree4965eb6707eb15ab5109b7d19986154e9b704489 /lib/files/view.php
parent0c73cae77b402355809c8f5f5be69d8a730fe3e2 (diff)
downloadnextcloud-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.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;