]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed the file sharing listing bug (filename is empty when it has no extension in...
authorBorjan Tchakaloff <borjan@tchakaloff.fr>
Wed, 5 Oct 2011 10:27:50 +0000 (14:27 +0400)
committerBorjan Tchakaloff <borjan@tchakaloff.fr>
Wed, 5 Oct 2011 10:27:50 +0000 (14:27 +0400)
apps/files_sharing/get.php

index 083f48e1127c458e93456a63048d245a6e2a8c92..38f4b2daedc1da68c52fe3409e9442b0f8f6d0fd 100644 (file)
@@ -30,8 +30,9 @@ if ($source !== false) {
                foreach (OC_Files::getdirectorycontent($source) as $i) {
                        $i['date'] = OC_Util::formatDate($i['mtime'] );
                        if ($i['type'] == 'file') {
-                               $i['extention'] = substr($i['name'], strrpos($i['name'], "."));
-                               $i['basename'] = substr($i['name'], 0, strrpos($i['name'], "."));
+                               $fileinfo = pathinfo($i['name']);
+                               $i['basename'] = $fileinfo['filename'];
+                               $i['extention'] = isset($fileinfo['extension']) ? ('.'.$fileinfo['extension']) : '';
                        }
                        $i['directory'] = substr($i['directory'], $rootLength);
                        if ($i['directory'] == "/") {