314parley / kfm

Automatically exported from code.google.com/p/kfm
0 stars 0 forks source link

Sub-directories permissions can kill the directory tree listing and files panel ajax call #79

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. In the OS cd into a directory that KFM will show in the tree
2. Make a subdirectory that does not have read or execute permissions for the 
webserver
3. Now go to your web browser, an in the side tree click on the parent 
directory to the sub-directory you made.

What is the expected output? What do you see instead?
It would show the file in the main panel, and subdirectories in the side panel 

What version of the product are you using? On what operating system?
1.4.6

Please provide any additional information below.
Running PHP 5.3.2, Ubuntu Linux 10.10, Sqlite

Original issue reported on code.google.com by ghy...@gmail.com on 11 Jan 2011 at 1:28

GoogleCodeExporter commented 8 years ago
We run into the same issue. Here's the patch:

Index: classes/kfmDirectory.php
===================================================================
--- classes/kfmDirectory.php    (revision x)
+++ classes/kfmDirectory.php    (revision y)
@@ -285,7 +285,14 @@
                return $directories;
        }
        function hasSubdirs(){
-               $dirs=new DirectoryIterator($this->path());
+                try
+                {
+                    $dirs=new DirectoryIterator($this->path());
+                }
+                catch ( Exception $e )
+                {
+                    return false;
+                }
                foreach($dirs as $dir){
                        if($dir->isDot())continue;
                        if($dir->isDir())return true;

(You still run in a timeout if you click the directory without permission 
later. But at least you can work now.)

Original comment by tho...@nunninger.info on 19 Jan 2012 at 1:29