MIME Type - Text Editor

Hi,

We are currently trying to add some Mimetype Aliases to our nextCloud instance.
We’ve created the config/mimetypealiases.json file with the following content:

{
“ps1”: [“text/code”, “text/plain”]
}

We then executed the following commands:

sudo -u our_username /opt/cpanel/ea-php70/root/usr/bin/php occ maintenance:mimetype:update-js
sudo -u our_username /opt/cpanel/ea-php70/root/usr/bin/php occ files:scan --all

Result from both command shows that it “seems” to have worked:
mimetypelist.js is updated

Scanning files for 3 users
Starting scan for user 1 out of 3 (xxxx)
Starting scan for user 2 out of 3 (xxxx)
Starting scan for user 3 out of 3 (xxxx)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 370     | 2547  | 00:00:01     |
+---------+-------+--------------+

However, existing .ps1 files are getting downloaded instead of being edited into the TextEditor.
Creating a new .ps1 file using the text editor works, but when saving the file and re-clicking on it, it prompts for download instead of online editing.

Are we missing something ?

Thanks!

Bump! Anyone ?

My idea was, that the editor needs to “support” the file formats as well. But looking into the app’s folder, only showed, that’s it’s already supported:

# grep -ir ps1 apps/files_texteditor/*
js/editor.js:           filetype["ps1"] = "powershell";
js/core/vendor/ace-builds/src-noconflict/ext-modelist.js:    Powershell:  ["ps1"],

Sorry, can’t figure it out.

No problem !
At least you’ve tried ! :slight_smile:

Anyone else would have an idea ?

Thanks !

Anyone has suggestion ?
Bump !

Its been almost 2 months now… So I guess there is no way to accomplish this ?

Hi,

I know it’s a late answer but you just have to add the following to ‘apps/files_texteditor/js/editor.js’
‘application/octet-stream’
Insert this in the highlighted array: https://github.com/nextcloud/files_texteditor/blob/master/js/editor.js#L237-L250

It’ll look like this afterwards:

getSupportedMimetypes: function() {
return [
‘text’,
‘application/cmd’,
‘application/javascript’,
‘application/json’,
‘application/xml’,
‘application/x-empty’,
‘application/x-msdos-program’,
‘application/x-php’,
‘application/x-pearl’,
‘application/x-text’,
‘application/yaml’,
‘application/octet-stream’
];

Hope this helps anyone who’s still interested.
There’s syntax highlighting aswell.