Browse Source

Fix FileInfo->getType errors

tags/v7.0.0alpha2
Robin Appelman 10 years ago
parent
commit
65f52fee4f
2 changed files with 9 additions and 2 deletions
  1. 8
    1
      lib/private/files/fileinfo.php
  2. 1
    1
      lib/public/files/fileinfo.php

+ 8
- 1
lib/private/files/fileinfo.php View File

} }


public function offsetGet($offset) { public function offsetGet($offset) {
if ($offset === 'type') {
return $this->getType();
}
return $this->data[$offset]; return $this->data[$offset];
} }


* @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() {
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(){

+ 1
- 1
lib/public/files/fileinfo.php View File



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…
Cancel
Save