aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-08-03 05:13:44 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2023-08-16 10:08:45 +0200
commit717276d1aba22f5354688972ebb17016a0bf37b3 (patch)
treec05a7117bb2d468de2aefc3b47dbc9e973ccc504
parent091c1edd21f5736523f9243b88580896fd6aec82 (diff)
downloadnextcloud-server-717276d1aba22f5354688972ebb17016a0bf37b3.tar.gz
nextcloud-server-717276d1aba22f5354688972ebb17016a0bf37b3.zip
fix(core): Modernize the mimetype handling
No need for jQuery or lodash as standard ECMA is supported by all of our supported browsers Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r--core/js/mimetype.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/js/mimetype.js b/core/js/mimetype.js
index 7f206548177..13a7ba6f6e5 100644
--- a/core/js/mimetype.js
+++ b/core/js/mimetype.js
@@ -42,21 +42,21 @@ OC.MimeType = {
var icon = mimeType.replace(new RegExp('/', 'g'), '-');
// Generate path
- if (mimeType === 'dir' && $.inArray('folder', files) !== -1) {
+ if (mimeType === 'dir' && files.includes('folder')) {
return 'folder';
- } else if (mimeType === 'dir-encrypted' && $.inArray('folder-encrypted', files) !== -1) {
+ } else if (mimeType === 'dir-encrypted' && files.includes('folder-encrypted')) {
return 'folder-encrypted';
- } else if (mimeType === 'dir-shared' && $.inArray('folder-shared', files) !== -1) {
+ } else if (mimeType === 'dir-shared' && files.includes('folder-shared')) {
return 'folder-shared';
- } else if (mimeType === 'dir-public' && $.inArray('folder-public', files) !== -1) {
+ } else if (mimeType === 'dir-public' && files.includes('folder-public')) {
return 'folder-public';
- } else if ((mimeType === 'dir-external' || mimeType === 'dir-external-root') && $.inArray('folder-external', files) !== -1) {
+ } else if ((mimeType === 'dir-external' || mimeType === 'dir-external-root') && files.includes('folder-external')) {
return 'folder-external';
- } else if ($.inArray(icon, files) !== -1) {
+ } else if (files.includes(icon)) {
return icon;
- } else if ($.inArray(icon.split('-')[0], files) !== -1) {
+ } else if (files.includes(icon.split('-')[0])) {
return icon.split('-')[0];
- } else if ($.inArray('file', files) !== -1) {
+ } else if (files.includes('file')) {
return 'file';
}
@@ -70,7 +70,7 @@ OC.MimeType = {
* @return {string} Url to the icon for mimeType
*/
getIconUrl: function(mimeType) {
- if (_.isUndefined(mimeType)) {
+ if (typeof mimeType === 'undefined') {
return undefined;
}
@@ -84,7 +84,7 @@ OC.MimeType = {
// First try to get the correct icon from the current theme
var gotIcon = null;
var path = '';
- if (OC.theme.folder !== '' && $.isArray(OC.MimeTypeList.themes[OC.theme.folder])) {
+ if (OC.theme.folder !== '' && Array.isArray(OC.MimeTypeList.themes[OC.theme.folder])) {
path = OC.getRootPath() + '/themes/' + OC.theme.folder + '/core/img/filetypes/';
var icon = OC.MimeType._getFile(mimeType, OC.MimeTypeList.themes[OC.theme.folder]);