]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed problems with a dots in a filenames
authorinfoneo <infoneo@yahoo.pl>
Sun, 12 May 2013 12:22:57 +0000 (15:22 +0300)
committerinfoneo <infoneo@yahoo.pl>
Sun, 12 May 2013 12:22:57 +0000 (15:22 +0300)
lib/files/mapper.php

index 97a2bff915ac950ad3c0d1ddd3e4e2e8c2498ae8..d9e116bf25b88b267aa66cfdf5e2f2162786d9b5 100644 (file)
@@ -176,16 +176,22 @@ class Mapper
                $last= end($pathElements);
                $parts = pathinfo($last);
                
-               if ((preg_match('~[-\w]+~', $parts['filename'])) && (preg_match('~[-\w]+~', $parts['extension']))){
+               $filename = $parts['filename'];
+               $extension = $parts['extension'];
+
+                       
+               if ((preg_match('~[-\w]+~', $filename)) && (preg_match('~[-\w]+~', $extension))){
                        
-                       // rip off the extension ext from last element
-                       $filename = $parts['filename'];
-                       array_pop($pathElements);
-                       array_push($pathElements, $filename);
+               // rip off the extension ext from last element
+               array_pop($pathElements);
+               array_push($pathElements, $filename);
                        
                } else {
                        
-                       unset($parts['extension']);
+                       if (isset($parts['extension'])) {
+                               unset($parts['extension']);
+                               }
+      
                } 
 
                foreach ($pathElements as $pathElement) {