diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php index 19b59971c4..270c6954a1 100644 --- a/apps/files/lib/Capabilities.php +++ b/apps/files/lib/Capabilities.php @@ -102,12 +102,9 @@ class Capabilities implements ICapability { 'id' => $id, 'name' => $creator->getName(), 'extension' => $creator->getExtension(), - 'templates' => false + 'templates' => $creator instanceof ACreateFromTemplate, + 'mimetype' => $creator->getMimetype() ]; - if ($creator instanceof ACreateFromTemplate) { - $capabilities['creators'][$id]['templates'] = true; - } - } } return $capabilities; diff --git a/lib/public/DirectEditing/ACreateEmpty.php b/lib/public/DirectEditing/ACreateEmpty.php index 79684e33b8..ab7f7fd3ae 100644 --- a/lib/public/DirectEditing/ACreateEmpty.php +++ b/lib/public/DirectEditing/ACreateEmpty.php @@ -59,6 +59,14 @@ abstract class ACreateEmpty { */ abstract public function getExtension(): string; + /** + * Mimetype of the resulting created file + * + * @since 18.0.0 + * @return string + */ + abstract public function getMimetype(): string; + /** * Add content when creating empty files * diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index a3d29efbce..9a56c3307e 100644 --- a/tests/lib/DirectEditing/ManagerTest.php +++ b/tests/lib/DirectEditing/ManagerTest.php @@ -31,6 +31,10 @@ class CreateEmpty extends ACreateEmpty { public function getExtension(): string { return '.txt'; } + + public function getMimetype(): string { + return 'text/plain'; + } } class Editor implements IEditor {