From aed7ed77d276fcf7e028ff9ae0930a1ba8f1a131 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 5 Dec 2013 12:18:06 +0100 Subject: [PATCH] Fixed file not found issue This fixes an issue where the second call would miss the "/files" part. The path attribute must keep "files" so that the next call to the File instance will still have the correct one. Fixes #155 --- lib/file.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/file.php b/lib/file.php index 265e6c78..84125bda 100644 --- a/lib/file.php +++ b/lib/file.php @@ -177,17 +177,18 @@ class File { /* to emit hooks properly, view root should contain /user/files */ if (strpos($this->path, 'files') === 0){ - $this->path = preg_replace('|^files|', '', $this->path); + $path = preg_replace('|^files|', '', $this->path); $view = new View('/' . $this->owner . '/files'); } else { + $path = $this->path; $view = new View('/' . $this->owner); } - if (!$view->file_exists($this->path)){ + if (!$view->file_exists($path)){ throw new \Exception($this->path . ' doesn\'t exist'); } - return array($view, $this->path); + return array($view, $path); } public function getOwner(){