diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-09-23 20:59:21 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-09-23 20:59:21 -0400 |
commit | 25b9e90ef3b6018f898047be025ad859fcbbd96a (patch) | |
tree | e2ad3195735200d7bf092733c8020a1249a22eac /app/Api/File.php | |
parent | 2af45250c46b431823a9bfaa28e393c70fb931d8 (diff) |
Do not check anymore data folder permissions
People who are using a remote database (Mysql/Postgresql) and a remote file storage (Aws S3 or similar) don't necessary needs to have a persistent local data folder or to change the permissions.
Diffstat (limited to 'app/Api/File.php')
-rw-r--r-- | app/Api/File.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/app/Api/File.php b/app/Api/File.php index 97aa9d82..ad736ad4 100644 --- a/app/Api/File.php +++ b/app/Api/File.php @@ -2,6 +2,8 @@ namespace Api; +use Core\ObjectStorage\ObjectStorageException; + /** * File API controller * @@ -22,16 +24,17 @@ class File extends \Core\Base public function downloadFile($file_id) { - $file = $this->file->getById($file_id); - - if (! empty($file)) { + try { - $filename = FILES_DIR.$file['path']; + $file = $this->file->getById($file_id); - if (file_exists($filename)) { - return base64_encode(file_get_contents($filename)); + if (! empty($file)) { + return base64_encode($this->objectStorage->get($file['path'])); } } + catch (ObjectStorageException $e) { + $this->logger->error($e->getMessage()); + } return ''; } |