Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mimetype application/internet-shortcut for .url files #6297

Merged
Merged
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
2 changes: 1 addition & 1 deletion core/Command/Maintenance/Mimetype/UpdateJS.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
*
* You can update the list of MimeType Aliases in config/mimetypealiases.json
* The list of files is fetched from core/img/filetypes
* To regenerate this file run ./occ maintenance:mimetypesjs
* To regenerate this file run ./occ maintenance:mimetype:update-js
*/
OC.MimeTypeList={
aliases: ' . json_encode($aliases, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . ',
Expand Down
1 change: 1 addition & 0 deletions core/img/filetypes/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion core/img/places/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions core/js/mimetypelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* You can update the list of MimeType Aliases in config/mimetypealiases.json
* The list of files is fetched from core/img/filetypes
* To regenerate this file run ./occ maintenance:mimetypesjs
* To regenerate this file run ./occ maintenance:mimetype:update-js
*/
OC.MimeTypeList={
aliases: {
Expand Down Expand Up @@ -94,7 +94,8 @@ OC.MimeTypeList={
"text/x-ldif": "text/code",
"text/x-python": "text/code",
"text/x-shellscript": "text/code",
"web": "text/code"
"web": "text/code",
"application/internet-shortcut": "link"
},
files: [
"application",
Expand All @@ -108,6 +109,7 @@ OC.MimeTypeList={
"folder-shared",
"folder-starred",
"image",
"link",
"location",
"package-x-generic",
"text",
Expand Down
15 changes: 14 additions & 1 deletion lib/private/Repair/RepairMimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private function updateMimetypes($updatedMimetypes) {
// insert mimetype
\OC_DB::executeAudited(self::insertStmt(), array($mimetype));
}

// get target mimetype id
$result = \OC_DB::executeAudited(self::getIdStmt(), array($mimetype));
$mimetypeId = $result->fetchOne();
Expand Down Expand Up @@ -140,6 +140,15 @@ private function introduceLocationTypes() {
$this->updateMimetypes($updatedMimetypes);
}

private function introduceInternetShortcutTypes() {
$updatedMimetypes = [
'url' => 'application/internet-shortcut',
'webloc' => 'application/internet-shortcut'
];

$this->updateMimetypes($updatedMimetypes);
}

/**
* Fix mime types
*/
Expand All @@ -161,5 +170,9 @@ public function run(IOutput $out) {
if (version_compare($ocVersionFromBeforeUpdate, '13.0.0.0', '<') && $this->introduceLocationTypes()) {
$out->info('Fixed geospatial mime types');
}

if (version_compare($ocVersionFromBeforeUpdate, '13.0.0.3', '<') && $this->introduceInternetShortcutTypes()) {
$out->info('Fixed internet-shortcut mime types');
}
}
}
6 changes: 4 additions & 2 deletions resources/config/mimetypemapping.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
"ogg": ["audio/ogg"],
"ogv": ["video/ogg"],
"one": ["application/msonenote"],
"opus": ["audio/ogg"],
"opus": ["audio/ogg"],
"orf": ["image/x-dcraw"],
"otf": ["application/font-sfnt"],
"pages": ["application/x-iwork-pages-sffpages"],
Expand Down Expand Up @@ -193,5 +193,7 @@
"xrf": ["image/x-dcraw"],
"yaml": ["application/yaml", "text/plain"],
"yml": ["application/yaml", "text/plain"],
"zip": ["application/zip"]
"zip": ["application/zip"],
"url": ["application/internet-shortcut"],
"webloc": ["application/internet-shortcut"]
}