1
0

Capabilities.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files;
  8. use OC\Files\FilenameValidator;
  9. use OCA\Files\Service\ChunkedUploadConfig;
  10. use OCP\Capabilities\ICapability;
  11. class Capabilities implements ICapability {
  12. public function __construct(
  13. protected FilenameValidator $filenameValidator,
  14. ) {
  15. }
  16. /**
  17. * Return this classes capabilities
  18. *
  19. * @return array{files: array{'$comment': ?string, bigfilechunking: bool, blacklisted_files: list<mixed>, forbidden_filenames: list<string>, forbidden_filename_basenames: list<string>, forbidden_filename_characters: list<string>, forbidden_filename_extensions: list<string>, chunked_upload: array{max_size: int, max_parallel_count: int}}}
  20. */
  21. public function getCapabilities(): array {
  22. return [
  23. 'files' => [
  24. '$comment' => '"blacklisted_files" is deprecated as of Nextcloud 30, use "forbidden_filenames" instead',
  25. 'blacklisted_files' => $this->filenameValidator->getForbiddenFilenames(),
  26. 'forbidden_filenames' => $this->filenameValidator->getForbiddenFilenames(),
  27. 'forbidden_filename_basenames' => $this->filenameValidator->getForbiddenBasenames(),
  28. 'forbidden_filename_characters' => $this->filenameValidator->getForbiddenCharacters(),
  29. 'forbidden_filename_extensions' => $this->filenameValidator->getForbiddenExtensions(),
  30. 'bigfilechunking' => true,
  31. 'chunked_upload' => [
  32. 'max_size' => ChunkedUploadConfig::getMaxChunkSize(),
  33. 'max_parallel_count' => ChunkedUploadConfig::getMaxParallelCount(),
  34. ],
  35. ],
  36. ];
  37. }
  38. }