diff --git a/apps/files/ajax/mimeicon.php b/apps/files/ajax/mimeicon.php
deleted file mode 100644
index 008ad41953ee78455add2fd8fd4810fc3c0cd29f..0000000000000000000000000000000000000000
--- a/apps/files/ajax/mimeicon.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program.  If not, see <http://www.gnu.org/licenses/>
- *
- */
-\OC::$server->getSession()->close();
-
-$mime = isset($_GET['mime']) ? (string)$_GET['mime'] : '';
-
-print OC_Helper::mimetypeIcon($mime);
diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php
index ceeb3cdcc8a5e66f6c9b21e2c38cea57727ffee0..5aa52f17a2979d8cf623edd6a703aa83052e4db7 100644
--- a/apps/files/appinfo/routes.php
+++ b/apps/files/appinfo/routes.php
@@ -66,8 +66,6 @@ $this->create('files_ajax_getstoragestats', 'ajax/getstoragestats.php')
 	->actionInclude('files/ajax/getstoragestats.php');
 $this->create('files_ajax_list', 'ajax/list.php')
 	->actionInclude('files/ajax/list.php');
-$this->create('files_ajax_mimeicon', 'ajax/mimeicon.php')
-	->actionInclude('files/ajax/mimeicon.php');
 $this->create('files_ajax_move', 'ajax/move.php')
 	->actionInclude('files/ajax/move.php');
 $this->create('files_ajax_newfile', 'ajax/newfile.php')
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 417c4b9fe99e07302edbbe0919991de7449a0f00..a3fd605ff7e2d1a075754465ab31cc44bf5e161f 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -670,7 +670,7 @@
 		 */
 		_createRow: function(fileData, options) {
 			var td, simpleSize, basename, extension, sizeColor,
-				icon = OC.Util.replaceSVGIcon(fileData.icon),
+				icon = OC.MimeType.getIconUrl(fileData.mimetype),
 				name = fileData.name,
 				type = fileData.type || 'file',
 				mtime = parseInt(fileData.mtime, 10),
@@ -1213,36 +1213,34 @@
 			var etag = options.etag;
 
 			// get mime icon url
-			OCA.Files.Files.getMimeIcon(mime, function(iconURL) {
-				var previewURL,
-					urlSpec = {};
-				ready(iconURL); // set mimeicon URL
+			var iconURL = OC.MimeType.getIconUrl(mime);
+			var previewURL,
+				urlSpec = {};
+			ready(iconURL); // set mimeicon URL
 
-				urlSpec.file = OCA.Files.Files.fixPath(path);
+			urlSpec.file = OCA.Files.Files.fixPath(path);
 
-				if (etag){
-					// use etag as cache buster
-					urlSpec.c = etag;
-				}
-				else {
-					console.warn('OCA.Files.FileList.lazyLoadPreview(): missing etag argument');
-				}
+			if (etag){
+				// use etag as cache buster
+				urlSpec.c = etag;
+			} else {
+				console.warn('OCA.Files.FileList.lazyLoadPreview(): missing etag argument');
+			}
 
-				previewURL = self.generatePreviewUrl(urlSpec);
-				previewURL = previewURL.replace('(', '%28');
-				previewURL = previewURL.replace(')', '%29');
-
-				// preload image to prevent delay
-				// this will make the browser cache the image
-				var img = new Image();
-				img.onload = function(){
-					// if loading the preview image failed (no preview for the mimetype) then img.width will < 5
-					if (img.width > 5) {
-						ready(previewURL);
-					}
-				};
-				img.src = previewURL;
-			});
+			previewURL = self.generatePreviewUrl(urlSpec);
+			previewURL = previewURL.replace('(', '%28');
+			previewURL = previewURL.replace(')', '%29');
+
+			// preload image to prevent delay
+			// this will make the browser cache the image
+			var img = new Image();
+			img.onload = function(){
+				// if loading the preview image failed (no preview for the mimetype) then img.width will < 5
+				if (img.width > 5) {
+					ready(previewURL);
+				}
+			};
+			img.src = previewURL;
 		},
 
 		setDirectoryPermissions: function(permissions) {
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 44868e78bd0a4ad5f98f42379d7916d578be6dce..1b498769dd60b00c45cdcb1233c314cdd7a26b1e 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -163,18 +163,14 @@
 			return OC.filePath('files', 'ajax', action + '.php') + q;
 		},
 
+		/**
+		 * Fetch the icon url for the mimetype
+		 * @param {string} mime The mimetype
+		 * @param {Files~mimeicon} ready Function to call when mimetype is retrieved
+		 * @deprecated use OC.MimeType.getIconUrl(mime)
+		 */
 		getMimeIcon: function(mime, ready) {
-			if (Files.getMimeIcon.cache[mime]) {
-				ready(Files.getMimeIcon.cache[mime]);
-			} else {
-				$.get( OC.filePath('files','ajax','mimeicon.php'), {mime: mime}, function(path) {
-					if(OC.Util.hasSVGSupport()){
-						path = path.substr(0, path.length-4) + '.svg';
-					}
-					Files.getMimeIcon.cache[mime]=path;
-					ready(Files.getMimeIcon.cache[mime]);
-				});
-			}
+			ready(OC.MimeType.getIconUrl(mime));
 		},
 
 		/**
@@ -211,7 +207,6 @@
 		 * Initialize the files view
 		 */
 		initialize: function() {
-			Files.getMimeIcon.cache = {};
 			Files.bindKeyboardShortcuts(document, $);
 
 			// TODO: move file list related code (upload) to OCA.Files.FileList
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index b12ac2f251723b9be466079520944ba74dd6f3d4..316df0281e9e0ded73083d61b3575bdfaf9faf54 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -697,7 +697,7 @@ describe('OCA.Files.FileList tests', function() {
 
 			expect(fileList.findFileEl('One.txt').length).toEqual(1);
 			expect(OC.TestUtil.getImageUrl(fileList.findFileEl('One.txt').find('.thumbnail')))
-				.toEqual(OC.imagePath('core', 'filetypes/file.svg'));
+				.toEqual(OC.imagePath('core', 'filetypes/text.svg'));
 		});
 	});
 	describe('Moving files', function() {
@@ -816,7 +816,7 @@ describe('OCA.Files.FileList tests', function() {
 			expect(notificationStub.getCall(0).args[0]).toEqual('Error while moving file');
 
 			expect(OC.TestUtil.getImageUrl(fileList.findFileEl('One.txt').find('.thumbnail')))
-				.toEqual(OC.imagePath('core', 'filetypes/file.svg'));
+				.toEqual(OC.imagePath('core', 'filetypes/text.svg'));
 		});
 	});
 	describe('List rendering', function() {
@@ -1161,7 +1161,8 @@ describe('OCA.Files.FileList tests', function() {
 			var fileData = {
 				type: 'file',
 				name: 'test dir',
-				icon: OC.webroot + '/core/img/filetypes/application-pdf.svg'
+				icon: OC.webroot + '/core/img/filetypes/application-pdf.svg',
+				mimetype: 'application/pdf'
 			};
 			var $tr = fileList.add(fileData);
 			var $imgDiv = $tr.find('td.filename .thumbnail');
diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js
index 1bbf4ffca09b778f43c86f49733f770b1d3522de..aa409285ca4d66a84e57c76907046c908b3522e0 100644
--- a/apps/files_sharing/tests/js/shareSpec.js
+++ b/apps/files_sharing/tests/js/shareSpec.js
@@ -90,7 +90,7 @@ describe('OCA.Sharing.Util tests', function() {
 				type: 'dir',
 				name: 'One',
 				path: '/subdir',
-				mimetype: 'text/plain',
+				mimetype: 'httpd/unix-directory',
 				size: 12,
 				permissions: OC.PERMISSION_ALL,
 				etag: 'abc'
diff --git a/config/mimetypealiases.json b/config/mimetypealiases.json
index d1684460eff58dbe5609d616325e21e42aa7a785..f1b13b67ee69e1cd96a24e3daade5ed502df00ff 100644
--- a/config/mimetypealiases.json
+++ b/config/mimetypealiases.json
@@ -4,65 +4,66 @@
 	"_comment3": "Otherwise your update won't propagate through the system",
 
 
-	"application/coreldraw": "image", 
-	"application/font-sfnt": "font", 
-	"application/font-woff": "font", 
-	"application/illustrator": "image/vector", 
-	"application/json": "text/code", 
-	"application/msaccess": "database", 
-	"application/msexcel": "x-office/spreadsheet", 
-	"application/mspowerpoint": "x-office/presentation", 
-	"application/msword": "x-office/document", 
-	"application/octet-stream": "file", 
-	"application/postscript": "image/vector", 
-	"application/vnd.android.package-archive": "package/x-generic", 
-	"application/vnd.ms-excel": "x-office/spreadsheet", 
-	"application/vnd.ms-excel.addin.macroEnabled.12": "x-office/spreadsheet", 
-	"application/vnd.ms-excel.sheet.binary.macroEnabled.12": "x-office/spreadsheet", 
-	"application/vnd.ms-excel.sheet.macroEnabled.12": "x-office/spreadsheet", 
-	"application/vnd.ms-excel.template.macroEnabled.12": "x-office/spreadsheet", 
-	"application/vnd.ms-fontobject": "font", 
-	"application/vnd.ms-powerpoint": "x-office/presentation", 
-	"application/vnd.ms-powerpoint.addin.macroEnabled.12": "x-office/presentation", 
-	"application/vnd.ms-powerpoint.presentation.macroEnabled.12": "x-office/presentation", 
-	"application/vnd.ms-powerpoint.slideshow.macroEnabled.12": "x-office/presentation", 
-	"application/vnd.ms-powerpoint.template.macroEnabled.12": "x-office/presentation", 
-	"application/vnd.ms-word.document.macroEnabled.12": "x-office/document", 
-	"application/vnd.ms-word.template.macroEnabled.12": "x-office/document", 
-	"application/vnd.oasis.opendocument.presentation": "x-office/presentation", 
-	"application/vnd.oasis.opendocument.presentation-template": "x-office/presentation", 
-	"application/vnd.oasis.opendocument.spreadsheet": "x-office/spreadsheet", 
-	"application/vnd.oasis.opendocument.spreadsheet-template": "x-office/spreadsheet", 
-	"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.text-web": "x-office/document", 
-	"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", 
-	"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "x-office/spreadsheet", 
-	"application/vnd.openxmlformats-officedocument.spreadsheetml.template": "x-office/spreadsheet", 
-	"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "x-office/document", 
-	"application/vnd.openxmlformats-officedocument.wordprocessingml.template": "x-office/document", 
-	"application/x-7z-compressed": "package/x-generic", 
-	"application/x-compressed": "package/x-generic", 
-	"application/x-dcraw": "image", 
-	"application/x-deb": "package/x-generic", 
-	"application/x-font": "font", 
-	"application/x-gimp": "image", 
-	"application/x-gzip": "package/x-generic", 
-	"application/x-perl": "text/code", 
-	"application/x-photoshop": "image", 
-	"application/x-php": "text/code", 
-	"application/x-rar-compressed": "package/x-generic", 
-	"application/x-tar": "package/x-generic", 
-	"application/x-tex": "text", 
-	"application/xml": "text/html", 
-	"application/yaml": "text/code", 
-	"application/zip": "package/x-generic", 
-	"image/svg+xml": "image/vector", 
-	"text/css": "text/code", 
-	"text/csv": "x-office/spreadsheet", 
+	"application/coreldraw": "image",
+	"application/font-sfnt": "font",
+	"application/font-woff": "font",
+	"application/illustrator": "image/vector",
+	"application/json": "text/code",
+	"application/msaccess": "database",
+	"application/msexcel": "x-office/spreadsheet",
+	"application/mspowerpoint": "x-office/presentation",
+	"application/msword": "x-office/document",
+	"application/octet-stream": "file",
+	"application/postscript": "image/vector",
+	"application/vnd.android.package-archive": "package/x-generic",
+	"application/vnd.ms-excel": "x-office/spreadsheet",
+	"application/vnd.ms-excel.addin.macroEnabled.12": "x-office/spreadsheet",
+	"application/vnd.ms-excel.sheet.binary.macroEnabled.12": "x-office/spreadsheet",
+	"application/vnd.ms-excel.sheet.macroEnabled.12": "x-office/spreadsheet",
+	"application/vnd.ms-excel.template.macroEnabled.12": "x-office/spreadsheet",
+	"application/vnd.ms-fontobject": "font",
+	"application/vnd.ms-powerpoint": "x-office/presentation",
+	"application/vnd.ms-powerpoint.addin.macroEnabled.12": "x-office/presentation",
+	"application/vnd.ms-powerpoint.presentation.macroEnabled.12": "x-office/presentation",
+	"application/vnd.ms-powerpoint.slideshow.macroEnabled.12": "x-office/presentation",
+	"application/vnd.ms-powerpoint.template.macroEnabled.12": "x-office/presentation",
+	"application/vnd.ms-word.document.macroEnabled.12": "x-office/document",
+	"application/vnd.ms-word.template.macroEnabled.12": "x-office/document",
+	"application/vnd.oasis.opendocument.presentation": "x-office/presentation",
+	"application/vnd.oasis.opendocument.presentation-template": "x-office/presentation",
+	"application/vnd.oasis.opendocument.spreadsheet": "x-office/spreadsheet",
+	"application/vnd.oasis.opendocument.spreadsheet-template": "x-office/spreadsheet",
+	"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.text-web": "x-office/document",
+	"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",
+	"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "x-office/spreadsheet",
+	"application/vnd.openxmlformats-officedocument.spreadsheetml.template": "x-office/spreadsheet",
+	"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "x-office/document",
+	"application/vnd.openxmlformats-officedocument.wordprocessingml.template": "x-office/document",
+	"application/x-7z-compressed": "package/x-generic",
+	"application/x-compressed": "package/x-generic",
+	"application/x-dcraw": "image",
+	"application/x-deb": "package/x-generic",
+	"application/x-font": "font",
+	"application/x-gimp": "image",
+	"application/x-gzip": "package/x-generic",
+	"application/x-perl": "text/code",
+	"application/x-photoshop": "image",
+	"application/x-php": "text/code",
+	"application/x-rar-compressed": "package/x-generic",
+	"application/x-tar": "package/x-generic",
+	"application/x-tex": "text",
+	"application/xml": "text/html",
+	"application/yaml": "text/code",
+	"application/zip": "package/x-generic",
+	"httpd/unix-directory": "dir",
+	"image/svg+xml": "image/vector",
+	"text/css": "text/code",
+	"text/csv": "x-office/spreadsheet",
 	"text/x-shellscript": "text/code"
 }
 
diff --git a/core/js/mimetypelist.js b/core/js/mimetypelist.js
index 2a780fc2bcb0da535d806218b91f9d7d012c81fb..b4de98247d1e743f55e9362979e3d17da391f8ce 100644
--- a/core/js/mimetypelist.js
+++ b/core/js/mimetypelist.js
@@ -64,6 +64,7 @@ OC.MimeTypeList={
     "application/xml": "text/html",
     "application/yaml": "text/code",
     "application/zip": "package/x-generic",
+    "httpd/unix-directory": "dir",
     "image/svg+xml": "image/vector",
     "text/css": "text/code",
     "text/csv": "x-office/spreadsheet",
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 9f88c2683698c3d6ffaee1ff8e7a52658072f1be..52ed34f61ec7ac970a30993477863c2bee961855 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -396,9 +396,8 @@ var OCdialogs = {
 				function(path){
 					$replacementDiv.find('.icon').css('background-image','url(' + path + ')');
 				}, function(){
-					Files.getMimeIcon(replacement.type,function(path){
-						$replacementDiv.find('.icon').css('background-image','url(' + path + ')');
-					});
+					path = OC.MimeType.getIconUrl(replacement.type);
+					$replacementDiv.find('.icon').css('background-image','url(' + path + ')');
 				}
 			);
 			$conflicts.append($conflict);