summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/webdav.php
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-06-29 13:00:41 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-06-29 13:01:00 -0400
commit719c7f7f6ebfe53a73eeffb07c6c23d6a788e711 (patch)
tree2ce73f8f811f68a0eb7a5367784ac9a62eb74259 /apps/files_external/lib/webdav.php
parent3ed7738d5efb7cfc86552d6992a8983d10b18310 (diff)
downloadnextcloud-server-719c7f7f6ebfe53a73eeffb07c6c23d6a788e711.tar.gz
nextcloud-server-719c7f7f6ebfe53a73eeffb07c6c23d6a788e711.zip
Fix WebDAV external storage opendir() and stat() for directories, bug fix for oc-1160
Diffstat (limited to 'apps/files_external/lib/webdav.php')
-rw-r--r--apps/files_external/lib/webdav.php26
1 files changed, 12 insertions, 14 deletions
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 94d9abb6a25..d0fe2aca854 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -73,13 +73,15 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$stripLength=strlen($this->root)+strlen($path);
$id=md5('webdav'.$this->root.$path);
OC_FakeDirStream::$dirs[$id]=array();
+ $skip = true;
foreach($response as $file=>$data){
- //strip root and path
- $file=trim(substr($file,$stripLength));
- $file=trim($file,'/');
- if($file){
- OC_FakeDirStream::$dirs[$id][]=$file;
+ // Skip the first file, because it is the current directory
+ if ($skip) {
+ $skip = false;
+ continue;
}
+ $file = urldecode(basename($file));
+ OC_FakeDirStream::$dirs[$id][]=$file;
}
return opendir('fakedir://'.$id);
}catch(Exception $e){
@@ -244,15 +246,11 @@ class OC_FileStorage_DAV extends OC_Filestorage_Common{
$path=$this->cleanPath($path);
try{
$response=$this->client->propfind($path, array('{DAV:}getlastmodified','{DAV:}getcontentlength'));
- if(isset($response['{DAV:}getlastmodified']) and isset($response['{DAV:}getcontentlength'])){
- return array(
- 'mtime'=>strtotime($response['{DAV:}getlastmodified']),
- 'size'=>(int)$response['{DAV:}getcontentlength'],
- 'ctime'=>-1,
- );
- }else{
- return array();
- }
+ return array(
+ 'mtime'=>strtotime($response['{DAV:}getlastmodified']),
+ 'size'=>(int)isset($response['{DAV:}getcontentlength']) ? $response['{DAV:}getcontentlength'] : 0,
+ 'ctime'=>-1,
+ );
}catch(Exception $e){
return array();
}