Can not open .py or .sh file

Two files, with exactly the same content, except one is .txt, another one is .sh, the .txt can be opened, but the .sh can not.

I tried to set the /var/www/html/config/mimetypealiases.json and /var/www/html/config/mimetypemapping.json, and I get to see the preview of the .sh file, but still can’t open it.

I also tried to use onlyoffice, but onlyoffice says it doesn’t support .sh file and didn’t even manage to open .txt file.

I don’t expect to edit the shell/python file, I just want to open it.
Please help.

I also tried .c file, didn’t work as well.
And I found that I can’t create source code files, either.

It just doesn’t make sense. code files should be shown the exact same way as plain text. Just treat them as you treated with plain files.

Do you guys have the same issues?

I also ran into this issue, I stumbled upon this thread:

After adding the file type to mapping and aliases, you may need to update the cache to have it register inside of nextcloud:

sudo -u www-data php occ maintenance:mimetype:update-db --repair-filecache 

After I made these changes I was able to edit Python (.py) files using NextCloud’s text editor.

cat ./config/mimetypealiases.json
"application/km": "mindmap"
"application/x-text": "py"

I just gave it up and install this app: