Commit 9124572c8f318c021632b9ed66adf081fa4ff176

Authored by Neil Blakey-Milner
1 parent 13e0a7af

Error out if the file or directory can not be read properly.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3662 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/import/fsimportstorage.inc.php
@@ -55,8 +55,14 @@ class KTFSImportStorage extends KTImportStorage { @@ -55,8 +55,14 @@ class KTFSImportStorage extends KTImportStorage {
55 return PEAR::raiseError('Failed to open folder'); 55 return PEAR::raiseError('Failed to open folder');
56 } 56 }
57 while (($sFilename = readdir($rDir)) !== false) { 57 while (($sFilename = readdir($rDir)) !== false) {
  58 + if (in_array($sFilename, array(".", ".."))) {
  59 + continue;
  60 + }
58 $sThisPath = sprintf("%s/%s", $sFullPath, $sFilename); 61 $sThisPath = sprintf("%s/%s", $sFullPath, $sFilename);
59 - if (is_file($sThisPath)) { 62 + if (!file_exists($sThisPath)) {
  63 + return PEAR::raiseError('Could not read file: ' . $sThisPath);
  64 + }
  65 + if (@is_file($sThisPath)) {
60 if (empty($sFolderPath)) { 66 if (empty($sFolderPath)) {
61 $ret[] = $sFilename; 67 $ret[] = $sFilename;
62 } else { 68 } else {
@@ -86,7 +92,10 @@ class KTFSImportStorage extends KTImportStorage { @@ -86,7 +92,10 @@ class KTFSImportStorage extends KTImportStorage {
86 continue; 92 continue;
87 } 93 }
88 $sThisPath = sprintf("%s/%s", $sFullPath, $sFilename); 94 $sThisPath = sprintf("%s/%s", $sFullPath, $sFilename);
89 - if (is_dir($sThisPath)) { 95 + if (!file_exists($sThisPath)) {
  96 + return PEAR::raiseError('Could not read file: ' . $sThisPath);
  97 + }
  98 + if (@is_dir($sThisPath)) {
90 if (empty($sFolderPath)) { 99 if (empty($sFolderPath)) {
91 $ret[] = $sFilename; 100 $ret[] = $sFilename;
92 } else { 101 } else {