diff options
author | Phie <phie@phie.ovh> | 2019-03-12 15:34:10 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-03-12 15:34:10 +0300 |
commit | a94ca2bca8da9db63c18bba81548d9e51b5ff3bb (patch) | |
tree | 1f3ed72bc9b00f79d2dec335533c02dbac341f24 | |
parent | bd48507597e6454d5a5af04464b9efe2bccac1f6 (diff) |
don't fail when no root folder
-rw-r--r-- | lib/Hooks/FSHooks.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Hooks/FSHooks.php b/lib/Hooks/FSHooks.php index 344bbd1..7baa8a0 100644 --- a/lib/Hooks/FSHooks.php +++ b/lib/Hooks/FSHooks.php @@ -23,10 +23,16 @@ class FSHooks { $this->folder = $this->Config->getUserValue($this->userId, $this->appName, "note_folder"); if(empty($folder)) $folder= 'Documents/QuickNote'; - $this->carnetFolder = $UserFolder->get($folder); + try{ + $this->carnetFolder = $UserFolder->get($folder); + } catch (\OCP\Files\NotFoundException $e){ + $this->carnetFolder = null; + } } public function postWrite($node) { + if($this->carnetFolder == null) + return; try{ if(substr($node->getName(), -3) === "sqd"){ // to avoid getting carnet's path each time a file is writen //we check if is in our path |