diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 17:50:34 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 17:50:34 +0200 |
commit | ff89824135298aa072c56f5a811f453df7ac3fe4 (patch) | |
tree | 43fa2941d995a6175c4918324cd0e91c775bf84f /lib | |
parent | fee8486b7f50422958909abe9fa1305039ecbbab (diff) | |
parent | c80dd82fe4c197cb09344a2ce25f790cd597b792 (diff) | |
download | nextcloud-server-ff89824135298aa072c56f5a811f453df7ac3fe4.tar.gz nextcloud-server-ff89824135298aa072c56f5a811f453df7ac3fe4.zip |
Merge pull request #19272 from owncloud/mimetypes-enhanced
Introduce a few new mimetypes for code, fix recursive mimetype aliases
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/type/detection.php | 2 | ||||
-rw-r--r-- | lib/repair/repairmimetypes.php | 52 |
2 files changed, 53 insertions, 1 deletions
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php index 0c647ab44c6..dc8aff2f30c 100644 --- a/lib/private/files/type/detection.php +++ b/lib/private/files/type/detection.php @@ -269,7 +269,7 @@ class Detection implements IMimeTypeDetector { public function mimeTypeIcon($mimetype) { $this->loadAliases(); - if (isset($this->mimeTypeAlias[$mimetype])) { + while (isset($this->mimeTypeAlias[$mimetype])) { $mimetype = $this->mimeTypeAlias[$mimetype]; } if (isset($this->mimetypeIcons[$mimetype])) { diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index db11f526ad6..b9cd42f3136 100644 --- a/lib/repair/repairmimetypes.php +++ b/lib/repair/repairmimetypes.php @@ -250,6 +250,39 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { self::updateMimetypes($updatedMimetypes); } + private function introduceJavaMimeType() { + $updatedMimetypes = array( + 'class' => 'application/java', + 'java' => 'text/x-java-source', + ); + + self::updateMimetypes($updatedMimetypes); + } + + private function introduceHppMimeType() { + $updatedMimetypes = array( + 'hpp' => 'text/x-h', + ); + + self::updateMimetypes($updatedMimetypes); + } + + private function introduceRssMimeType() { + $updatedMimetypes = array( + 'rss' => 'application/rss+xml', + ); + + self::updateMimetypes($updatedMimetypes); + } + + private function introduceRtfMimeType() { + $updatedMimetypes = array( + 'rtf' => 'text/rtf', + ); + + self::updateMimetypes($updatedMimetypes); + } + /** * Fix mime types */ @@ -294,5 +327,24 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { $this->emit('\OC\Repair', 'info', array('Fixed Yaml/Yml mime types')); } } + + // Mimetype updates from #19272 + if (version_compare($ocVersionFromBeforeUpdate, '8.2.0.8', '<')) { + if ($this->introduceJavaMimeType()) { + $this->emit('\OC\Repair', 'info', array('Fixed java/class mime types')); + } + + if ($this->introduceHppMimeType()) { + $this->emit('\OC\Repair', 'info', array('Fixed hpp mime type')); + } + + if ($this->introduceRssMimeType()) { + $this->emit('\OC\Repair', 'info', array('Fixed rss mime type')); + } + + if ($this->introduceRtfMimeType()) { + $this->emit('\OC\Repair', 'info', array('Fixed rtf mime type')); + } + } } } |