[Pkg-owncloud-commits] [owncloud] 77/95: Check if we have a proper fileinfo
David Prévot
taffit at moszumanska.debian.org
Wed Mar 11 15:49:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.0.1
in repository owncloud.
commit c77fd2eef64fb96734c0047c27e03b500ab022e3
Author: Robin Appelman <icewind at owncloud.com>
Date: Mon Feb 23 14:36:51 2015 +0100
Check if we have a proper fileinfo
---
lib/private/files/node/node.php | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/lib/private/files/node/node.php b/lib/private/files/node/node.php
index 536483f..9446bff 100644
--- a/lib/private/files/node/node.php
+++ b/lib/private/files/node/node.php
@@ -8,6 +8,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 {
@@ -45,11 +49,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;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list