summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-02-23 14:36:51 +0100
committerRobin Appelman <icewind@owncloud.com>2015-02-25 16:02:08 +0100
commitf5befbeac64ee21ff12ba12ee8e25c743979714b (patch)
tree2ac2d2a9a8e2414370f1f5273d3bf03bec23fcf4 /lib
parentf5b62267325415b307cf2d47b69d11d4337536e4 (diff)
downloadnextcloud-server-f5befbeac64ee21ff12ba12ee8e25c743979714b.tar.gz
nextcloud-server-f5befbeac64ee21ff12ba12ee8e25c743979714b.zip
Check if we have a proper fileinfo
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/node/node.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/private/files/node/node.php b/lib/private/files/node/node.php
index 4c7d32cbd0e..2d46596a088 100644
--- a/lib/private/files/node/node.php
+++ b/lib/private/files/node/node.php
@@ -23,6 +23,10 @@
*/
namespace OC\Files\Node;
+use OC\Files\Filesystem;
+use OCP\Files\FileInfo;
+use OCP\Files\InvalidPathException;
+use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
class Node implements \OCP\Files\Node {
@@ -60,11 +64,21 @@ class Node implements \OCP\Files\Node {
/**
* Returns the matching file info
*
- * @return \OCP\Files\FileInfo
+ * @return FileInfo
+ * @throws InvalidPathException
+ * @throws NotFoundException
*/
public function getFileInfo() {
+ if (!Filesystem::isValidPath($this->path)) {
+ throw new InvalidPathException();
+ }
if (!$this->fileInfo) {
- $this->fileInfo = $this->view->getFileInfo($this->path);
+ $fileInfo = $this->view->getFileInfo($this->path);
+ if ($fileInfo instanceof FileInfo) {
+ $this->fileInfo = $fileInfo;
+ } else {
+ throw new NotFoundException();
+ }
}
return $this->fileInfo;
}