WebIDE doesn't highlight syntax of Perl modules correctly
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label. For the Community Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=bug For the Enterprise Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary We do use locally latest release of GitLab CE. We have some projects written in Perl which consists of hundreds of Perl modules(with `.pm` extension). While we do have more or less correct syntax highlight in single-page file preview, on WebIDE we see just plain text. API reports that `mime_type` of file is `application/x-pagemaker`. I did a little discovery and find out that you use two different editors: - ACE - Monaco The first one highlights the syntax correctly on basis of a file extension as it seems. While the second one orients on `mime-type`. `mime-types` utilized in detection and first result is taken which gives us this result: ``` root@aac38ed14ab5:/tmp# ruby t.rb application/x-python application/x-pagemaker application/x-perl root@aac38ed14ab5:/tmp# cat t.rb require 'mime/types' puts MIME::Types.type_for('py') puts MIME::Types.type_for('pm') ``` Since `GitLab` CE [uses only first value returned](https://gitlab.com/gitlab-org/gitlab-ce/blob/v11.9.1/lib/gitlab/blob_helper.rb#L61), which is `application/x-pagemaker`. Obviously, unlikely we do use this ancient Adobe software. It actually surprised me why this library thinks that `python` and `perl` scripts are [binary files](). ### Steps to reproduce 1. Open any Perl module in `WebIDE` 2. See no syntax highlight whatsoever ### What is the current *bug* behavior? No syntax highlights for Perl modules in WebIDE. ### What is the expected *correct* behavior? Perl modules obtain syntax highlighting in WebIDE ### Possible fixes Either extend parent module behavior or re-think the `text-only` predicate for filtering mime-types.
issue