{"action":"created","issue":{"url":"https://api.github.com/repos/getgrav/grav/issues/369","labels_url":"https://api.github.com/repos/getgrav/grav/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/getgrav/grav/issues/369/comments","events_url":"https://api.github.com/repos/getgrav/grav/issues/369/events","html_url":"https://github.com/getgrav/grav/issues/369","id":111949177,"number":369,"title":"Make getMimeType function configurable","user":{"login":"maxlysenko","id":12494082,"avatar_url":"https://avatars.githubusercontent.com/u/12494082?v=3","gravatar_id":"","url":"https://api.github.com/users/maxlysenko","html_url":"https://github.com/maxlysenko","followers_url":"https://api.github.com/users/maxlysenko/followers","following_url":"https://api.github.com/users/maxlysenko/following{/other_user}","gists_url":"https://api.github.com/users/maxlysenko/gists{/gist_id}","starred_url":"https://api.github.com/users/maxlysenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxlysenko/subscriptions","organizations_url":"https://api.github.com/users/maxlysenko/orgs","repos_url":"https://api.github.com/users/maxlysenko/repos","events_url":"https://api.github.com/users/maxlysenko/events{/privacy}","received_events_url":"https://api.github.com/users/maxlysenko/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-17T07:31:09Z","updated_at":"2015-10-19T05:44:14Z","closed_at":"2015-10-19T02:28:32Z","body":"I suggest to create some configuration for mime types.\r\nFor example, add something like this\r\n```yaml\r\nmimetypes:\r\n  - mimetype: 'image/jpg'\r\n    extensions: [jpeg, jpg, jpe]\r\n  - mimetype: 'image/svg+xml'\r\n    extensions: [svg]\r\n```\r\ninto `system.yaml` or into separate `mimetypes.yaml` configuration file.\r\n\r\nThen add something like this\r\n```php\r\n$mimetypes = self::getGrav()['config']->get('mimetypes.mimetypes', []);\r\n\r\nforeach ($mimetypes as $mimetype) {\r\n    if (in_array($extension, $mimetype['extensions'])) {\r\n        return $mimetype['mimetype'];\r\n    }\r\n}\r\n```\r\ninto the `getMimeType` function in the `Utils.php`.\r\n\r\nIn that way it will be possible to add some extensions/mime types/content types without altering source code. So if it is needed to add `xlsx`, `pptx`, or some other extension or content type it could be done it the configuration file inside `user/config` folder."},"comment":{"url":"https://api.github.com/repos/getgrav/grav/issues/comments/149107899","html_url":"https://github.com/getgrav/grav/issues/369#issuecomment-149107899","issue_url":"https://api.github.com/repos/getgrav/grav/issues/369","id":149107899,"user":{"login":"maxlysenko","id":12494082,"avatar_url":"https://avatars.githubusercontent.com/u/12494082?v=3","gravatar_id":"","url":"https://api.github.com/users/maxlysenko","html_url":"https://github.com/maxlysenko","followers_url":"https://api.github.com/users/maxlysenko/followers","following_url":"https://api.github.com/users/maxlysenko/following{/other_user}","gists_url":"https://api.github.com/users/maxlysenko/gists{/gist_id}","starred_url":"https://api.github.com/users/maxlysenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxlysenko/subscriptions","organizations_url":"https://api.github.com/users/maxlysenko/orgs","repos_url":"https://api.github.com/users/maxlysenko/repos","events_url":"https://api.github.com/users/maxlysenko/events{/privacy}","received_events_url":"https://api.github.com/users/maxlysenko/received_events","type":"User","site_admin":false},"created_at":"2015-10-19T05:44:14Z","updated_at":"2015-10-19T05:44:14Z","body":"You know, SVG file was described in the `system/config/media.yaml`.\r\nSo why SVG was not working until @flaviocopes fixed #366 .\r\nAnd where is it already configurable? I can not see any configuration in the [`getMimeType`](https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Utils.php#L264) function in [`Utils.php`](https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Utils.php)."}}