summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2014-03-09 23:34:01 +0100
committerThomas Tanghus <thomas@tanghus.net>2014-03-09 23:34:01 +0100
commit212699e389e12e8f9fa7f30992b9b799c11c0299 (patch)
tree32839d981f422d3a2b6292733b52913825b6cca2
parent9a31e533130ed6902719051bb854d0994d6ff86b (diff)
parent51165a1a04a8a97a5d7ac684b0588a86c01a0018 (diff)
downloadnextcloud-server-212699e389e12e8f9fa7f30992b9b799c11c0299.tar.gz
nextcloud-server-212699e389e12e8f9fa7f30992b9b799c11c0299.zip
Merge pull request #7628 from owncloud/fileinfo-type
Fix FileInfo->getType errors
-rw-r--r--lib/private/files/fileinfo.php16
-rw-r--r--lib/public/files/fileinfo.php2
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/files/fileinfo.php b/lib/private/files/fileinfo.php
index 2dbdd80a26b..d6940f50bf1 100644
--- a/lib/private/files/fileinfo.php
+++ b/lib/private/files/fileinfo.php
@@ -53,7 +53,13 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
}
public function offsetGet($offset) {
- return $this->data[$offset];
+ if ($offset === 'type') {
+ return $this->getType();
+ } elseif (isset($this->data[$offset])) {
+ return $this->data[$offset];
+ } else {
+ return null;
+ }
}
/**
@@ -144,10 +150,14 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
* @return \OCP\Files\FileInfo::TYPE_FILE | \OCP\Files\FileInfo::TYPE_FOLDER
*/
public function getType() {
- return $this->data['type'];
+ if (isset($this->data['type'])) {
+ return $this->data['type'];
+ } else {
+ return $this->getMimetype() === 'httpd/unix-directory' ? self::TYPE_FOLDER : self::TYPE_FILE;
+ }
}
- public function getData(){
+ public function getData() {
return $this->data;
}
diff --git a/lib/public/files/fileinfo.php b/lib/public/files/fileinfo.php
index 68ce45d3fa1..37162e09336 100644
--- a/lib/public/files/fileinfo.php
+++ b/lib/public/files/fileinfo.php
@@ -9,7 +9,7 @@ namespace OCP\Files;
interface FileInfo {
const TYPE_FILE = 'file';
- const TYPE_FOLDER = 'folder';
+ const TYPE_FOLDER = 'dir';
/**
* Get the Etag of the file or folder