Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Custom File Extensions To Be Edited By Text Editor When Clicked Instead Of Downloading #266

Open
Sheepings opened this issue Aug 14, 2020 · 1 comment

Comments

@Sheepings
Copy link

-## Steps to reproduce

  1. Upload a unknown file extension like file.cs or file_x.aspx
  2. Click the file you uploaded
  3. It will download, but it should open in an editor...

Expected behaviour

I'd expect there would be an interface for adding file extensions which would open custom file types in text/code editor.
The expected files should open in an editor. But there is no way to add custom file extensions manually through the Nextcloud web interface, and have them files open in an editor, instead of bring forced to download.

Actual behaviour

The file clicked will start downloading, instead of opening in a text editor. There isn't any menu option to open with text editor either.

UBuntu 18.04:

Web server:

Database: MySQL 5.7.31

PHP version: 7.2.33

Nextcloud version: 19 (see Nextcloud admin page)

Client configuration

Browser: Opera

Operating system: Ubuntu 18.04

@biguenique
Copy link

You can set file extensions to treat as text files by mapping the file extension to a mime type in Nextcloud.
This is not defined by Texteditor but in Nextcloud.

  1. Create (or edit) a file named <nextcloud>/config/mimetypemapping.json and add your mappings, eg.:
{
  "aspx": ["text/code"],
  "cs" : ["text/code"]
}
  1. Update Nextcloud's mapping (run with your www-data user):
$ php occ maintenance:mimetype:update-js
  1. Important! Rescan your files to apply changes to existing files (run with www-data user):
$ php occ files:scan --all

References (read them!) :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants