diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-11-26 13:07:15 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-11-27 19:56:44 +0100 |
commit | 329e8c2604a35bded6afac75b59f611002d6db5e (patch) | |
tree | 3d8db1ff09c786554d2d19e122a9811fe7b38f13 | |
parent | 9a2694fcb0093afee13d0cd91de15b34b747cc62 (diff) | |
download | nextcloud-server-329e8c2604a35bded6afac75b59f611002d6db5e.tar.gz nextcloud-server-329e8c2604a35bded6afac75b59f611002d6db5e.zip |
Add mimetype to creators
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r-- | apps/files/lib/Capabilities.php | 7 | ||||
-rw-r--r-- | lib/public/DirectEditing/ACreateEmpty.php | 8 | ||||
-rw-r--r-- | tests/lib/DirectEditing/ManagerTest.php | 4 |
3 files changed, 14 insertions, 5 deletions
diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php index 19b59971c4c..270c6954a1a 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 79684e33b80..ab7f7fd3ae8 100644 --- a/lib/public/DirectEditing/ACreateEmpty.php +++ b/lib/public/DirectEditing/ACreateEmpty.php @@ -60,6 +60,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 * * @since 18.0.0 diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php index a3d29efbce5..9a56c3307e0 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 { |