nextcloud /
gallery
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Nextcloud - Gallery |
||
| 4 | * |
||
| 5 | * This file is licensed under the Affero General Public License version 3 or |
||
| 6 | * later. See the COPYING file. |
||
| 7 | * |
||
| 8 | * @author Olivier Paroz <[email protected]> |
||
| 9 | * |
||
| 10 | * @copyright Olivier Paroz 2017 |
||
| 11 | */ |
||
| 12 | |||
| 13 | namespace OCA\Gallery\Service; |
||
| 14 | |||
| 15 | use OCP\Files\File; |
||
|
0 ignored issues
–
show
|
|||
| 16 | |||
| 17 | |||
| 18 | /** |
||
| 19 | * Prepares the file to download |
||
| 20 | * |
||
| 21 | * @package OCA\Gallery\Service |
||
| 22 | */ |
||
| 23 | class DownloadService extends Service { |
||
| 24 | |||
| 25 | use Base64Encode; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Downloads the requested file |
||
| 29 | * |
||
| 30 | * @param File $file |
||
| 31 | * @param bool $base64Encode |
||
| 32 | * |
||
| 33 | * @return array|false |
||
| 34 | * @throws NotFoundServiceException |
||
| 35 | */ |
||
| 36 | public function downloadFile($file, $base64Encode = false) { |
||
| 37 | try { |
||
| 38 | $this->logger->debug( |
||
| 39 | "[DownloadService] File to Download: {name}", ['name' => $file->getName()] |
||
| 40 | ); |
||
| 41 | $download = [ |
||
| 42 | 'preview' => $file->getContent(), |
||
| 43 | 'mimetype' => $file->getMimeType() |
||
| 44 | ]; |
||
| 45 | |||
| 46 | if ($base64Encode) { |
||
| 47 | $download['preview'] = $this->encode($download['preview']); |
||
| 48 | } |
||
| 49 | |||
| 50 | return $download; |
||
| 51 | } catch (\Exception $exception) { |
||
| 52 | throw new NotFoundServiceException('There was a problem accessing the file'); |
||
| 53 | } |
||
| 54 | |||
| 55 | } |
||
| 56 | |||
| 57 | } |
||
| 58 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths