Merge pull request #7628 from owncloud/fileinfo-type
Fix FileInfo->getType errors
This commit is contained in:
commit
212699e389
|
@ -53,7 +53,13 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function offsetGet($offset) {
|
public function offsetGet($offset) {
|
||||||
|
if ($offset === 'type') {
|
||||||
|
return $this->getType();
|
||||||
|
} elseif (isset($this->data[$offset])) {
|
||||||
return $this->data[$offset];
|
return $this->data[$offset];
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,7 +150,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
||||||
* @return \OCP\Files\FileInfo::TYPE_FILE | \OCP\Files\FileInfo::TYPE_FOLDER
|
* @return \OCP\Files\FileInfo::TYPE_FILE | \OCP\Files\FileInfo::TYPE_FOLDER
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType() {
|
||||||
|
if (isset($this->data['type'])) {
|
||||||
return $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() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace OCP\Files;
|
||||||
|
|
||||||
interface FileInfo {
|
interface FileInfo {
|
||||||
const TYPE_FILE = 'file';
|
const TYPE_FILE = 'file';
|
||||||
const TYPE_FOLDER = 'folder';
|
const TYPE_FOLDER = 'dir';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Etag of the file or folder
|
* Get the Etag of the file or folder
|
||||||
|
|
Loading…
Reference in New Issue