Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add mimetype to creators
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Nov 27, 2019
commit 329e8c2604a35bded6afac75b59f611002d6db5e
7 changes: 2 additions & 5 deletions apps/files/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@ private function getDirectEditingCapabilitites(): array {
'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;
Expand Down
8 changes: 8 additions & 0 deletions lib/public/DirectEditing/ACreateEmpty.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ abstract public function getName(): string;
*/
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
*
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/DirectEditing/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public function getName(): string {
public function getExtension(): string {
return '.txt';
}

public function getMimetype(): string {
return 'text/plain';
}
}

class Editor implements IEditor {
Expand Down