lib/private/Files/Type/Detection.php
/**
	 * Get path to the icon of a file type
	 * @param string $mimetype the MIME type
	 * @return string the url
	 */
Get path to the icon of a file type
@param string $mimetype the MIME type
@return string the url
Get path to the icon of a file type @param string $mimetype the MIME type @return string the url
public function mimeTypeIcon($mimetype) {
		$this->loadAliases();
		while (isset($this->mimeTypeAlias[$mimetype])) {
			$mimetype = $this->mimeTypeAlias[$mimetype];
		}
		if (isset($this->mimetypeIcons[$mimetype])) {
			return $this->mimetypeIcons[$mimetype];
		}
		$icon = str_replace('/', '-', $mimetype);
		$icon = str_replace('\\', '-', $icon);
				if ($mimetype === 'dir') {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder.svg');
			return $this->mimetypeIcons[$mimetype];
		}
		if ($mimetype === 'dir-shared') {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-shared.svg');
			return $this->mimetypeIcons[$mimetype];
		}
		if ($mimetype === 'dir-external') {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/folder-external.svg');
			return $this->mimetypeIcons[$mimetype];
		}
				try {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg');
			return $this->mimetypeIcons[$mimetype];
		} catch (\RuntimeException $e) {
		}
		$mimePart = substr($icon, 0, strpos($icon, '-'));
		try {
			$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg');
			return $this->mimetypeIcons[$mimetype];
		} catch (\RuntimeException $e) {
		}
		$this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/file.svg');
		return $this->mimetypeIcons[$mimetype];
	}
public function mimeTypeIcon ( $ mimetype ) { $ this -> loadAliases ( ) ; while ( isset ( $ this -> mimeTypeAlias [ $ mimetype ] ) ) { $ mimetype = $ this -> mimeTypeAlias [ $ mimetype ] ; } if ( isset ( $ this -> mimetypeIcons [ $ mimetype ] ) ) { return $ this -> mimetypeIcons [ $ mimetype ] ; } $ icon = str_replace ( '/' , '-' , $ mimetype ) ; $ icon = str_replace ( '\\' , '-' , $ icon ) ; if ( $ mimetype === 'dir' ) { $ this -> mimetypeIcons [ $ mimetype ] = $ this -> urlGenerator -> imagePath ( 'core' , 'filetypes/folder.svg' ) ; return $ this -> mimetypeIcons [ $ mimetype ] ; } if ( $ mimetype === 'dir-shared' ) { $ this -> mimetypeIcons [ $ mimetype ] = $ this -> urlGenerator -> imagePath ( 'core' , 'filetypes/folder-shared.svg' ) ; return $ this -> mimetypeIcons [ $ mimetype ] ; } if ( $ mimetype === 'dir-external' ) { $ this -> mimetypeIcons [ $ mimetype ] = $ this -> urlGenerator -> imagePath ( 'core' , 'filetypes/folder-external.svg' ) ; return $ this -> mimetypeIcons [ $ mimetype ] ; } try { $ this -> mimetypeIcons [ $ mimetype ] = $ this -> urlGenerator -> imagePath ( 'core' , 'filetypes/' . $ icon . '.svg' ) ; return $ this -> mimetypeIcons [ $ mimetype ] ; } catch ( \ RuntimeException $ e ) { } $ mimePart = substr ( $ icon , 0 , strpos ( $ icon , '-' ) ) ; try { $ this -> mimetypeIcons [ $ mimetype ] = $ this -> urlGenerator -> imagePath ( 'core' , 'filetypes/' . $ mimePart . '.svg' ) ; return $ this -> mimetypeIcons [ $ mimetype ] ; } catch ( \ RuntimeException $ e ) { } $ this -> mimetypeIcons [ $ mimetype ] = $ this -> urlGenerator -> imagePath ( 'core' , 'filetypes/file.svg' ) ; return $ this -> mimetypeIcons [ $ mimetype ] ; }
Get path to the icon of a file type
 @param string $mimetype the MIME type
 @return string the url
Get path to the icon of a file type @param string $mimetype the MIME type @return string the url
// Replace slash and backslash with a minus // Is it a dir?
 // Icon exists?
 // Specified image not found // Try only the first part of the filetype // Image for the first part of the mimetype not found