diff options
author | Max Kamashev <kamashev@gollard.ru> | 2015-09-24 12:07:40 +0300 |
---|---|---|
committer | Max Kamashev <kamashev@gollard.ru> | 2015-09-24 12:07:40 +0300 |
commit | 3f5b636c998171837fc2265f760359b421d67b61 (patch) | |
tree | a505f4f1767efff50224b649e647a02ae3638e12 /app/Api/File.php | |
parent | 5b2e49d2945ce2c1daaf4dd78746a910eab9c9c8 (diff) | |
parent | 1b0b69a43f7528fd5188d4b48216c6fa7e32eac3 (diff) |
Merge branch 'master' of https://github.com/ukko/kanboard into 1245_bug_with_subtask_timer
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 ''; } |