Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/private/Repair/RepairMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,18 @@ private function introduceTextType(): IResult|int|null {
return $this->updateMimetypes($updatedMimetypes);
}

/**
* @throws Exception
* @since 33.0.0
*/
private function introduceTomlAndOvpnType(): IResult|int|null {
$updatedMimetypes = [
'ovpn' => 'application/x-openvpn-profile',
'toml' => 'application/toml',
];

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

/**
* Check if there are any migrations available
Expand Down Expand Up @@ -482,6 +493,10 @@ public function run(IOutput $output): void {
$output->info('Fixed text mime type');
}

if (version_compare($mimeTypeVersion, '33.0.0.0', '<') && $this->introduceTomlAndOvpnType()) {
$output->info('Fixed toml and ovpn mime type');
}

if (!$this->dryRun) {
$this->appConfig->setValueString('files', 'mimetype_version', $serverVersion);
}
Expand Down
2 changes: 2 additions & 0 deletions resources/config/mimetypealiases.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"application/octet-stream": "file",
"application/postscript": "image",
"application/rss+xml": "application/xml",
"application/toml": "text/code",
"application/vnd.android.package-archive": "package/x-generic",
"application/vnd.excalidraw+json": "whiteboard",
"application/vnd.garmin.tcx+xml": "location",
Expand Down Expand Up @@ -92,6 +93,7 @@
"application/x-iwork-numbers-sffnumbers": "x-office/spreadsheet",
"application/x-iwork-pages-sffpages": "x-office/document",
"application/x-mobipocket-ebook": "text",
"application/x-openvpn-profile": "text",
"application/x-perl": "text/code",
"application/x-photoshop": "image",
"application/x-php": "text/code",
Expand Down
4 changes: 3 additions & 1 deletion resources/config/mimetypemapping.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"otp": ["application/vnd.oasis.opendocument.presentation-template"],
"ots": ["application/vnd.oasis.opendocument.spreadsheet-template"],
"ott": ["application/vnd.oasis.opendocument.text-template"],
"ovpn": ["application/x-openvpn-profile", "text/plain"],
"pages": ["application/x-iwork-pages-sffpages"],
"pdf": ["application/pdf"],
"pef": ["image/x-dcraw"],
Expand Down Expand Up @@ -194,12 +195,13 @@
"tbz2": ["application/x-bzip2"],
"tcx": ["application/vnd.garmin.tcx+xml"],
"tex": ["application/x-tex"],
"text": ["text/plain"],
"tga": ["image/tga"],
"tgz": ["application/gzip"],
"tif": ["image/tiff"],
"tiff": ["image/tiff"],
"toml": ["application/toml", "text/code"],
"ttf": ["application/font-sfnt"],
"text": ["text/plain"],
"txt": ["text/plain"],
"url": ["application/internet-shortcut"],
"vcard": ["text/vcard"],
Expand Down
2 changes: 2 additions & 0 deletions resources/config/mimetypenames.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"application/postscript": "PostScript document",
"application/rss+xml": "RSS summary",
"application/sgf": "",
"application/toml": "TOML configuration file",
"application/vnd.android.package-archive": "Android package",
"application/vnd.excalidraw+json": "",
"application/vnd.garmin.tcx+xml": "",
Expand Down Expand Up @@ -105,6 +106,7 @@
"application/x-ms-dos-executable": "",
"application/x-msdos-program": "",
"application/x-msi": "Windows Installer package",
"application/x-openvpn-profile": "OpenVPN connection profile",
"application/x-perl": "Perl script",
"application/x-photoshop": "",
"application/x-php": "PHP script",
Expand Down
Loading