Skip to content
Snippets Groups Projects
Commit f2a0f190 authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

bugfixing galore

parent 73754544
No related branches found
No related tags found
No related merge requests found
...@@ -196,10 +196,16 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin { ...@@ -196,10 +196,16 @@ class OwnCloudPlugin extends StudIPPlugin implements FilesystemPlugin {
foreach ($doc->getElementsByTagNameNS("DAV:","response") as $file) { foreach ($doc->getElementsByTagNameNS("DAV:","response") as $file) {
foreach ($file->childNodes as $node) { foreach ($file->childNodes as $node) {
if (strtolower($node->tagName) === "d:propstat") { if (strtolower($node->tagName) === "d:propstat") {
foreach ($node->childNodes as $prop) { if ($node->childNodes) {
foreach ($prop->childNodes as $attr) { foreach ($node->childNodes as $prop) {
if (strtolower($attr->tagName) === "d:resourcetype") { if ($prop->childNodes) {
return $file_attributes['type'] = ($attr->childNodes[0] && strtolower($attr->childNodes[0]->tagName) === "d:collection") ? "folder" : "file"; foreach ($prop->childNodes as $attr) {
if (strtolower($attr->tagName) === "d:resourcetype") {
return $file_attributes['type'] = ($attr->childNodes[0] && strtolower($attr->childNodes[0]->tagName) === "d:collection")
? "folder"
: "file";
}
}
} }
} }
} }
......
...@@ -308,11 +308,12 @@ class OwncloudFolder extends VirtualFolderType { ...@@ -308,11 +308,12 @@ class OwncloudFolder extends VirtualFolderType {
'range_id' => 'OwnCloudPlugin' 'range_id' => 'OwnCloudPlugin'
), $this->plugin_id); ), $this->plugin_id);
} else { } else {
$content_type = $file_attributes['contenttype'] ?: get_mime_type($file_attributes['name']);
$this->files[] = (object) array( $this->files[] = (object) array(
'id' => ($this->id ? $this->id."/" : "") . rawurlencode($file_attributes['name']), 'id' => ($this->id ? $this->id."/" : "") . rawurlencode($file_attributes['name']),
'name' => $file_attributes['name'], 'name' => $file_attributes['name'],
'size' => $file_attributes['size'], 'size' => $file_attributes['size'],
'mime_type' => $file_attributes['contenttype'], 'mime_type' => $content_type,
'description' => "", 'description' => "",
'chdate' => $file_attributes['chdate'], 'chdate' => $file_attributes['chdate'],
'download_url' => URLHelper::getURL( "plugins.php/owncloudplugin/download/".($this->id ? $this->id."/" : "").$file_attributes['name']) 'download_url' => URLHelper::getURL( "plugins.php/owncloudplugin/download/".($this->id ? $this->id."/" : "").$file_attributes['name'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment