[Pkg-owncloud-commits] [owncloud] 337/394: know your libraries ; -)

David Prévot taffit at alioth.debian.org
Fri Nov 8 23:12:44 UTC 2013


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.

commit f8b103fb131e8657ac4ef16eace440193531fda2
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Sat Feb 9 14:01:34 2013 +0100

    know your libraries ;-)
    
    strrpos fails in cases the file in the path has no dot but the parent folder
---
 lib/filesystemview.php |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/filesystemview.php b/lib/filesystemview.php
index 7dde0f7..f21192f 100644
--- a/lib/filesystemview.php
+++ b/lib/filesystemview.php
@@ -431,7 +431,7 @@ class OC_FilesystemView {
 					$result = OC_Helper::streamCopy($source, $target);
 				}
 				if( $this->fakeRoot==OC_Filesystem::getRoot() ){
-					// If the file to be copied originates within
+					// If the file to be copied originates within
 					// the user's data directory
 					
 					OC_Hook::emit(
@@ -517,11 +517,7 @@ class OC_FilesystemView {
 		if(OC_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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list