Skip to content

Commit b1d9670

Browse files
committed
feat(capabilities): return conversion capabilities
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
1 parent 21fbe9a commit b1d9670

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lib/private/CapabilitiesManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(LoggerInterface $logger) {
3232
}
3333

3434
/**
35-
* Get an array of al the capabilities that are registered at this manager
35+
* Get an array of all the capabilities that are registered at this manager
3636
*
3737
* @param bool $public get public capabilities only
3838
* @throws \InvalidArgumentException

lib/private/OCS/CoreCapabilities.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace OC\OCS;
99

1010
use OCP\Capabilities\ICapability;
11+
use OCP\Conversion\IConversionManager;
1112
use OCP\IConfig;
1213
use OCP\IURLGenerator;
1314

@@ -22,6 +23,7 @@ class CoreCapabilities implements ICapability {
2223
*/
2324
public function __construct(
2425
private IConfig $config,
26+
private IConversionManager $conversionManager,
2527
) {
2628
}
2729

@@ -34,6 +36,7 @@ public function __construct(
3436
* webdav-root: string,
3537
* reference-api: boolean,
3638
* reference-regex: string,
39+
* conversions: array<string, string|array<string>>,
3740
* mod-rewrite-working: boolean,
3841
* },
3942
* }
@@ -45,6 +48,7 @@ public function getCapabilities(): array {
4548
'webdav-root' => $this->config->getSystemValueString('webdav-root', 'remote.php/webdav'),
4649
'reference-api' => true,
4750
'reference-regex' => IURLGenerator::URL_REGEX_NO_MODIFIERS,
51+
'conversions' => array_merge([], ...$this->conversionManager->getMimeTypes()),
4852
'mod-rewrite-working' => $this->config->getSystemValueBool('htaccess.IgnoreFrontController') || getenv('front_controller_active') === 'true',
4953
],
5054
];

lib/private/Server.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,10 @@ public function __construct($webRoot, \OC\Config $config) {
10081008
$this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) {
10091009
$manager = new CapabilitiesManager($c->get(LoggerInterface::class));
10101010
$manager->registerCapability(function () use ($c) {
1011-
return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class));
1011+
return new \OC\OCS\CoreCapabilities(
1012+
$c->get(\OCP\IConfig::class),
1013+
$c->get(\OCP\Conversion\IConversionManager::class)
1014+
);
10121015
});
10131016
$manager->registerCapability(function () use ($c) {
10141017
return $c->get(\OC\Security\Bruteforce\Capabilities::class);

0 commit comments

Comments
 (0)