Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

Commit

Permalink
Add more supported mimes read ODF formats
Browse files Browse the repository at this point in the history
Add an array for support mimes read formats
Use this array in getSupportedMimetypes method to avoid "is not supported by Documents app" Exception
Skip read formats in searchDocuments method
  • Loading branch information
tpayen authored and VicDeo committed Mar 2, 2016
1 parent 902d3fa commit 4cabd8d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@

class Storage {
const MIMETYPE_LIBREOFFICE_WORDPROCESSOR = 'application/vnd.oasis.opendocument.text';
private static $SUPPORTED_MIMES_READ = array(
'application/vnd.oasis.opendocument.spreadsheet',
'application/vnd.oasis.opendocument.presentation',
'application/vnd.oasis.opendocument.graphics',
);

public static function getDocuments() {
$list = array_filter(
Expand Down Expand Up @@ -92,14 +97,17 @@ public static function onDelete($params) {
protected static function searchDocuments(){
$documents = array();
foreach (self::getSupportedMimetypes() as $mime){
$documents = array_merge($documents, \OCP\Files::searchByMime($mime));
if (!in_array($mime, self::$SUPPORTED_MIMES_READ)) {
$documents = array_merge($documents, \OCP\Files::searchByMime($mime));
}
}
return $documents;
}

public static function getSupportedMimetypes(){
return array_merge(
array(self::MIMETYPE_LIBREOFFICE_WORDPROCESSOR),
self::$SUPPORTED_MIMES_READ,
Filter::getAll()
);
}
Expand Down

0 comments on commit 4cabd8d

Please sign in to comment.