Skip to content

Commit

Permalink
Merge pull request #32481 from nextcloud/feature/add-docxf-form-mimet…
Browse files Browse the repository at this point in the history
…ypes

Add docxf and form mimetypes
  • Loading branch information
juliusknorr authored Jun 7, 2022
2 parents dcf25d6 + 50ed84f commit 0f6fc32
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 258 deletions.
5 changes: 5 additions & 0 deletions core/img/filetypes/x-office-form-template.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions core/img/filetypes/x-office-form.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion core/js/mimetypelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ OC.MimeTypeList={
"application/internet-shortcut": "link",
"application/km": "mindmap",
"application/x-freemind": "mindmap",
"application/vnd.xmind.workbook": "mindmap"
"application/vnd.xmind.workbook": "mindmap",
"image/targa": "image/tga",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform": "x-office/form",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf": "x-office/form-template"
},
files: [
"application",
Expand All @@ -136,6 +139,8 @@ OC.MimeTypeList={
"video",
"x-office-document",
"x-office-drawing",
"x-office-form",
"x-office-form-template",
"x-office-presentation",
"x-office-spreadsheet"
],
Expand Down
3 changes: 2 additions & 1 deletion lib/private/IntegrityCheck/Checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ private function generateHashes(\RecursiveIteratorIterator $iterator,
if ($filename === $this->environmentHelper->getServerRoot() . '/core/js/mimetypelist.js') {
$oldMimetypeList = new GenerateMimetypeFileBuilder();
$newFile = $oldMimetypeList->generateFile($this->mimeTypeDetector->getAllAliases());
if ($newFile === file_get_contents($filename)) {
$oldFile = $this->fileAccessHelper->file_get_contents($filename);
if ($newFile === $oldFile) {
$hashes[$relativeFileName] = hash('sha512', $oldMimetypeList->generateFile($this->mimeTypeDetector->getOnlyDefaultAliases()));
continue;
}
Expand Down
13 changes: 13 additions & 0 deletions lib/private/Repair/RepairMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ private function introduceOrgModeType() {
return $this->updateMimetypes($updatedMimetypes);
}

private function introduceOnlyofficeFormType() {
$updatedMimetypes = [
"oform" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform",
"docxf" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf",
];

return $this->updateMimetypes($updatedMimetypes);
}


/**
* Fix mime types
Expand Down Expand Up @@ -260,5 +269,9 @@ public function run(IOutput $out) {
if (version_compare($ocVersionFromBeforeUpdate, '23.0.0.2', '<') && $this->introduceFlatOpenDocumentType()) {
$out->info('Fixed Flat OpenDocument mime types');
}

if (version_compare($ocVersionFromBeforeUpdate, '25.0.0.2', '<') && $this->introduceOnlyofficeFormType()) {
$out->info('Fixed ONLYOFFICE Forms OpenXML mime types');
}
}
}
4 changes: 3 additions & 1 deletion resources/config/mimetypealiases.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@
"application/km": "mindmap",
"application/x-freemind": "mindmap",
"application/vnd.xmind.workbook": "mindmap",
"image/targa": "image/tga"
"image/targa": "image/tga",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform": "x-office/form",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf": "x-office/form-template"
}

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
OC.MimeTypeList={
aliases: {
"application/coreldraw": "image",
"application/test": "image",
"application/epub+zip": "text",
"application/font-sfnt": "image",
"application/font-woff": "image",
Expand Down Expand Up @@ -111,7 +110,11 @@ OC.MimeTypeList={
"application/internet-shortcut": "link",
"application/km": "mindmap",
"application/x-freemind": "mindmap",
"application/vnd.xmind.workbook": "mindmap"
"application/vnd.xmind.workbook": "mindmap",
"image/targa": "image/tga",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform": "x-office/form",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf": "x-office/form-template",
"my-custom/mimetype": "custom"
},
files: [
"application",
Expand All @@ -137,6 +140,8 @@ OC.MimeTypeList={
"video",
"x-office-document",
"x-office-drawing",
"x-office-form",
"x-office-form-template",
"x-office-presentation",
"x-office-spreadsheet"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"hashes": {
"core\/js\/mimetypelist.js": "b04161ccafa1fae9ce92393f9e293e70523a7cfde1ffd71ef980a287048fde559d2fd24575652220a821e61ca398b87caab96d533e210c7ee7f48a7cdfcf9bb7"
},
"signature": "sxNvTR6Y7xfMGFHsHTSYUtBHRtnWb+1ELf4zdgulFv\/4emGrmG2l+oZc+alHIMeBCgWHSrEDmgbtuJ0V6NJCD+yeoGhOJbkqXd9+oFtkIr1ciheg\/AnLnUdSFjmUwsyilVK2VRXIUYsYpRf1gLx0yHoJeif+dZMiNIbgsw3DJn8yNQjwOEFny2ofotV1j79SdSWRvW0PAIaiOMoA0mHyRb95hVL79mHHREpOpfmXStGegXqiHz49ppDrvwG1I3PyjHXl\/2hef5Xn0uzcjk4r5ruVSJB\/dy5pS\/KuxnlrhdwBKl3Lhb0bc5ptwToACIQuWiClr\/lIyqlzdaEWCTYiR8sagvTxS1TzcTgj0gTV3ZCwg+xhMWmkoQ7KBjA9gifgiF\/ADGx+HjgvDH+vZkY1wmima1n3n9muTi+kRmT10zUgtKEAWFCfHH3LoqozSwAqwrLFlU2FYzashK98ip78R6\/+QC23UlqGNDa1i+URWJ8ltksayw047NfhL2isvsfPMLSGeVuqRpg0ht7A4EBKBO2y5cHpEdkHlEbaO7KoV40YKEkYHO5w+EuY\/jmqkENNq\/WRJT4jgzFFdlS3DOUnaHma+oPBas8MTA9PdCb9LDaGYzUyJp+ObBfDxUWGSSRCbYnKAdpqlD+OZMTlpf628LXN64SccN4qkL8AtCZ7Gwk=",
"certificate": "-----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