From ddc7af9a53fb78a363c21043ab0e2e1a80b48750 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thomas=20M=C3=BCller?= <thomas.mueller@tmit.eu>
Date: Sat, 9 Feb 2013 13:51:44 +0100
Subject: [PATCH] know your libraries ;-)

strrpos fails in cases the file in the path has no dot but the parent folder
---
 lib/files/view.php | 6 +-----
 1 file changed, 1 insertion(+), 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;
-- 
GitLab