]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix commong filestorage for files without extention
authorRobin Appelman <icewind@owncloud.com>
Sat, 3 Mar 2012 17:24:10 +0000 (18:24 +0100)
committerRobin Appelman <icewind@owncloud.com>
Sat, 3 Mar 2012 20:23:35 +0000 (21:23 +0100)
lib/filestorage/common.php

index ed12e67eeb3eb904d54f4bc4ae635710e01dff1c..f632474df01d62f9cae1812d96369f83eab65fab 100644 (file)
@@ -99,7 +99,11 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
                        return false;
                }
                $head=fread($source,8192);//8kb should suffice to determine a mimetype
-               $extention=substr($path,strrpos($path,'.'));
+               if($pos=strrpos($path,'.')){
+                       $extention=substr($path,$pos);
+               }else{
+                       $extention='';
+               }
                $tmpFile=OC_Helper::tmpFile($extention);
                file_put_contents($tmpFile,$head);
                $mime=OC_Helper::getMimeType($tmpFile);
@@ -124,7 +128,11 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
                if(!$source){
                        return false;
                }
-               $extention=substr($path,strrpos($path,'.'));
+               if($pos=strrpos($path,'.')){
+                       $extention=substr($path,$pos);
+               }else{
+                       $extention='';
+               }
                $tmpFile=OC_Helper::tmpFile($extention);
                $target=fopen($tmpFile,'w');
                $count=OC_Helper::streamCopy($source,$target);