Browse Source

Add OpenDocument flat mimetypes and x-office/drawing alias

Signed-off-by: Julius Härtl <jus@bitgrid.net>
Julius Härtl 2 years ago
parent
commit
0d2e05a0b5

+ 1 - 0
core/img/filetypes/x-office-drawing.svg

@@ -0,0 +1 @@
+<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.5 1c-.28 0-.5.22-.5.5v13c0 .28.22.5.5.5h11c.28 0 .5-.22.5-.5V4l-3-3H2.5zM4 6h2.8v1.2h2.4V6H12v3.2H9.2V8h-.8v3.2h.8V10H12v3.2H9.2V12H7.6V8h-.8v1.2H4V6z" style="fill:#ebc94a;fill-opacity:1"/></svg>

+ 7 - 0
core/js/mimetypelist.js

@@ -55,7 +55,13 @@ OC.MimeTypeList={
     "application/vnd.oasis.opendocument.text": "x-office/document",
     "application/vnd.oasis.opendocument.text-master": "x-office/document",
     "application/vnd.oasis.opendocument.text-template": "x-office/document",
+    "application/vnd.oasis.opendocument.graphics": "x-office/drawing",
+    "application/vnd.oasis.opendocument.graphics-template": "x-office/drawing",
     "application/vnd.oasis.opendocument.text-web": "x-office/document",
+    "application/vnd.oasis.opendocument.text-flat-xml": "x-office/document",
+    "application/vnd.oasis.opendocument.spreadsheet-flat-xml": "x-office/spreadsheet",
+    "application/vnd.oasis.opendocument.graphics-flat-xml": "x-office/drawing",
+    "application/vnd.oasis.opendocument.presentation-flat-xml": "x-office/presentation",
     "application/vnd.openxmlformats-officedocument.presentationml.presentation": "x-office/presentation",
     "application/vnd.openxmlformats-officedocument.presentationml.slideshow": "x-office/presentation",
     "application/vnd.openxmlformats-officedocument.presentationml.template": "x-office/presentation",
@@ -129,6 +135,7 @@ OC.MimeTypeList={
     "text-vcard",
     "video",
     "x-office-document",
+    "x-office-drawing",
     "x-office-presentation",
     "x-office-spreadsheet"
 ],

+ 15 - 0
lib/private/Repair/RepairMimeTypes.php

@@ -192,6 +192,17 @@ class RepairMimeTypes implements IRepairStep {
 		return $this->updateMimetypes($updatedMimetypes);
 	}
 
+	private function introduceFlatOpenDocumentType() {
+		$updatedMimetypes = [
+			"fodt" => "application/vnd.oasis.opendocument.text-flat-xml",
+			"fods" => "application/vnd.oasis.opendocument.spreadsheet-flat-xml",
+			"fodg" => "application/vnd.oasis.opendocument.graphics-flat-xml",
+			"fodp" => "application/vnd.oasis.opendocument.presentation-flat-xml",
+		];
+
+		return $this->updateMimetypes($updatedMimetypes);
+	}
+
 	private function introduceOrgModeType() {
 		$updatedMimetypes = [
 			'org' => 'text/org'
@@ -245,5 +256,9 @@ class RepairMimeTypes implements IRepairStep {
 		if (version_compare($ocVersionFromBeforeUpdate, '21.0.0.7', '<') && $this->introduceOrgModeType()) {
 			$out->info('Fixed orgmode mime types');
 		}
+
+		if (version_compare($ocVersionFromBeforeUpdate, '23.0.0.2', '<') && $this->introduceFlatOpenDocumentType()) {
+			$out->info('Fixed Flat OpenDocument mime types');
+		}
 	}
 }

+ 6 - 0
resources/config/mimetypealiases.dist.json

@@ -55,7 +55,13 @@
 	"application/vnd.oasis.opendocument.text": "x-office/document",
 	"application/vnd.oasis.opendocument.text-master": "x-office/document",
 	"application/vnd.oasis.opendocument.text-template": "x-office/document",
+	"application/vnd.oasis.opendocument.graphics": "x-office/drawing",
+	"application/vnd.oasis.opendocument.graphics-template": "x-office/drawing",
 	"application/vnd.oasis.opendocument.text-web": "x-office/document",
+	"application/vnd.oasis.opendocument.text-flat-xml": "x-office/document",
+	"application/vnd.oasis.opendocument.spreadsheet-flat-xml": "x-office/spreadsheet",
+	"application/vnd.oasis.opendocument.graphics-flat-xml": "x-office/drawing",
+	"application/vnd.oasis.opendocument.presentation-flat-xml": "x-office/presentation",
 	"application/vnd.openxmlformats-officedocument.presentationml.presentation": "x-office/presentation",
 	"application/vnd.openxmlformats-officedocument.presentationml.slideshow": "x-office/presentation",
 	"application/vnd.openxmlformats-officedocument.presentationml.template": "x-office/presentation",

+ 4 - 0
resources/config/mimetypemapping.dist.json

@@ -127,6 +127,10 @@
 	"ots": ["application/vnd.oasis.opendocument.spreadsheet-template"],
 	"otp": ["application/vnd.oasis.opendocument.presentation-template"],
 	"otg": ["application/vnd.oasis.opendocument.graphics-template"],
+	"fodt": ["application/vnd.oasis.opendocument.text-flat-xml"],
+	"fods": ["application/vnd.oasis.opendocument.spreadsheet-flat-xml"],
+	"fodg": ["application/vnd.oasis.opendocument.graphics-flat-xml"],
+	"fodp": ["application/vnd.oasis.opendocument.presentation-flat-xml"],
 	"oga": ["audio/ogg"],
 	"ogg": ["audio/ogg"],
 	"ogv": ["video/ogg"],

+ 1 - 1
version.php

@@ -30,7 +30,7 @@
 // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
 // when updating major/minor version number.
 
-$OC_Version = [23, 0, 0, 1];
+$OC_Version = [23, 0, 0, 2];
 
 // The human readable string
 $OC_VersionString = '23.0.0 alpha';