• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 32993735329

26 Aug 2026 05:19PM UTC coverage: 68.022% (+22.7%) from 45.341%
32993735329

push

github

web-flow
Merge pull request #8072 from LibreSign/chore/say-hello-to-nextcloud36

chore: say hello to Nextcloud 36

16292 of 23951 relevant lines covered (68.02%)

11.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/Controller/DevelopController.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Controller;
10

11
use OCA\Libresign\AppInfo\Application;
12
use OCP\AppFramework\Controller;
13
use OCP\AppFramework\Http;
14
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
15
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
16
use OCP\AppFramework\Http\Attribute\OpenAPI;
17
use OCP\AppFramework\Http\Attribute\PublicPage;
18
use OCP\AppFramework\Http\DataResponse;
19
use OCP\AppFramework\Http\FileDisplayResponse;
20
use OCP\AppFramework\Http\Response;
21
use OCP\Files\SimpleFS\InMemoryFile;
22
use OCP\IConfig;
23
use OCP\IRequest;
24

25
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
26
class DevelopController extends Controller {
27
        public function __construct(
28
                IRequest $request,
29
                private IConfig $config,
30
        ) {
31
                parent::__construct(Application::APP_ID, $request);
×
32
        }
33

34
        /**
35
         * Get a demo PDF file to be used by test purpose
36
         *
37
         * To use this endpoint is necessary to enable the debug mode in your instance. To do this, run the command:
38
         *
39
         * `occ config:system:set debug --value true --type boolean`
40
         *
41
         * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: 'application/pdf',Content-Disposition: 'inline; filename="file.pdf"'}>|DataResponse<Http::STATUS_NOT_FOUND, array<empty>, array{}>
42
         *
43
         * 200: PDF returned
44
         * 404: Debug mode not enabled
45
         * @psalm-suppress InvalidReturnType
46
         */
47
        #[NoCSRFRequired]
48
        #[PublicPage]
49
        #[FrontpageRoute(verb: 'GET', url: '/develop/pdf')]
50
        public function pdf(): FileDisplayResponse|Response {
51
                if (!$this->isDebugMode()) {
×
52
                        return new DataResponse([], Http::STATUS_NOT_FOUND);
×
53
                }
54
                $file = new InMemoryFile('file.pdf', file_get_contents(__DIR__ . '/../../tests/php/fixtures/pdfs/small_valid.pdf'));
×
55
                $response = new FileDisplayResponse($file);
×
56
                $response->setHeaders([
×
57
                        'Content-Disposition' => 'inline; filename="file.pdf"',
×
58
                        'Content-Type' => 'application/pdf',
×
59
                ]);
×
60
                /** @psalm-suppress InvalidReturnStatement */
61
                return $response;
×
62
        }
63

64
        public function isDebugMode(): bool {
65
                return $this->config->getSystemValue('debug', false) === true;
×
66
        }
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc