summaryrefslogtreecommitdiffstats
path: root/files/ajax
diff options
context:
space:
mode:
authorRobin Appelman <icewind1991@gmail.com>2011-07-12 17:45:01 +0200
committerRobin Appelman <icewind1991@gmail.com>2011-07-12 17:45:01 +0200
commit190908bc1e48a8c948c8fed8251c85a2055bd0a6 (patch)
tree71e58c1c2d0f9dcd7db63b1c2966b077020a3d32 /files/ajax
parent9e420e46398fee6ccf9ca2f9288561c3673b6c34 (diff)
downloadnextcloud-server-190908bc1e48a8c948c8fed8251c85a2055bd0a6.tar.gz
nextcloud-server-190908bc1e48a8c948c8fed8251c85a2055bd0a6.zip
fix error in autocomplete when try to list non-existing or unreadable folders
Diffstat (limited to 'files/ajax')
-rw-r--r--files/ajax/autocomplete.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/files/ajax/autocomplete.php b/files/ajax/autocomplete.php
index af235379800..2c2f665fd6c 100644
--- a/files/ajax/autocomplete.php
+++ b/files/ajax/autocomplete.php
@@ -40,17 +40,19 @@ $query=strtolower($query);
$files=array();
-if(OC_FILESYSTEM::is_dir($base)){
+if(OC_FILESYSTEM::file_exists($base) and OC_FILESYSTEM::is_dir($base)){
$dh = OC_FILESYSTEM::opendir($base);
- if(substr($base,-1,1)!='/'){
- $base=$base.'/';
- }
- while (($file = readdir($dh)) !== false) {
- if ($file != "." && $file != ".."){
- if(substr(strtolower($file),0,$queryLen)==$query){
- $item=$base.$file;
- if((!$dirOnly or OC_FILESYSTEM::is_dir($item))){
- $files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item);
+ if($dh){
+ if(substr($base,-1,1)!='/'){
+ $base=$base.'/';
+ }
+ while (($file = readdir($dh)) !== false) {
+ if ($file != "." && $file != ".."){
+ if(substr(strtolower($file),0,$queryLen)==$query){
+ $item=$base.$file;
+ if((!$dirOnly or OC_FILESYSTEM::is_dir($item))){
+ $files[]=(object)array('id'=>$item,'label'=>$item,'name'=>$item);
+ }
}
}
}