-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Register application/x-kdbx the right way #124
Changes from 6 commits
4d1fdaf
9e25ca7
7904a7c
c676507
8411f39
e0ee3d9
6d6ae18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -2,29 +2,26 @@ | |||
|
||||
namespace OCA\Keeweb\Migration; | ||||
|
||||
use OCP\Migration\IRepairStep; | ||||
use OCP\IDBConnection; | ||||
use OCP\Files\IMimeTypeLoader; | ||||
use OCP\Migration\IOutput; | ||||
use OCP\Migration\IRepairStep; | ||||
|
||||
class AddMimetypeToFilecache implements IRepairStep { | ||||
public function __construct(IDBConnection $connection) {} | ||||
|
||||
public function getName() { | ||||
return "Add custom mimetype to filecache"; | ||||
} | ||||
|
||||
public function run(IOutput $output) { | ||||
$mimeTypeDetector = \OC::$server->getMimeTypeDetector(); | ||||
$mimeTypeLoader = \OC::$server->getMimeTypeLoader(); | ||||
private $mimeTypeLoader; | ||||
|
||||
// Register custom mimetype | ||||
$mimeTypeDetector->getAllMappings(); | ||||
$mimeTypeDetector->registerType('kdbx', 'x-application/kdbx', 'x-application/kdbx'); | ||||
public function __construct(IMimeTypeLoader $mimeTypeLoader) { | ||||
$this->mimeTypeLoader = $mimeTypeLoader; | ||||
} | ||||
|
||||
// And update the filecache for it. | ||||
$mimetypeId = $mimeTypeLoader->getId('x-application/kdbx'); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nextcloud-keeweb/keeweb/js/viewer.js Line 21 in 380e78f
Do not work because they mimetype is created as |
||||
$mimeTypeLoader->updateFilecache('%.kdbx', $mimetypeId); | ||||
public function getName() { | ||||
return 'Add custom mimetype to filecache'; | ||||
} | ||||
|
||||
$output->info("Added custom mimetype to filecache."); | ||||
} | ||||
public function run(IOutput $output) { | ||||
// And update the filecache for it. | ||||
$mimetypeId = $this->mimeTypeLoader->getId('application/x-kdbx'); | ||||
$this->mimeTypeLoader->updateFilecache('kdbx', $mimetypeId); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||
$output->info('Added custom mimetype to filecache.'); | ||||
} | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @rullzer @nickvergessen does that make sense? ;) For a dav request we need to announce the mime type to nextcloud. The app itself is not required. I'm trying to save some resources by skipping the app initialization.