Commit 9124572c8f318c021632b9ed66adf081fa4ff176
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
Showing
1 changed file
with
11 additions
and
2 deletions
lib/import/fsimportstorage.inc.php
| ... | ... | @@ -55,8 +55,14 @@ class KTFSImportStorage extends KTImportStorage { |
| 55 | 55 | return PEAR::raiseError('Failed to open folder'); |
| 56 | 56 | } |
| 57 | 57 | while (($sFilename = readdir($rDir)) !== false) { |
| 58 | + if (in_array($sFilename, array(".", ".."))) { | |
| 59 | + continue; | |
| 60 | + } | |
| 58 | 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 | 66 | if (empty($sFolderPath)) { |
| 61 | 67 | $ret[] = $sFilename; |
| 62 | 68 | } else { |
| ... | ... | @@ -86,7 +92,10 @@ class KTFSImportStorage extends KTImportStorage { |
| 86 | 92 | continue; |
| 87 | 93 | } |
| 88 | 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 | 99 | if (empty($sFolderPath)) { |
| 91 | 100 | $ret[] = $sFilename; |
| 92 | 101 | } else { | ... | ... |