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

Unrecongized file extensions are prompted for download instead of opening in text editor #30566

Open
bitshiftnetau opened this issue Jan 6, 2022 · 4 comments
Labels
1. to develop Accepted and waiting to be taken care of enhancement pending documentation This pull request needs an associated documentation update

Comments

@bitshiftnetau
Copy link

Files with unrecognized extensions, namely .ps1, are prompted for download instead of opening in a text editor. It seems this is the default for unrecognized extensions, which should absolutely not be the case.

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Create a file with extension .ps1
  2. Try to open it in the browser with single-click
  3. Witness download prompt

Expected behaviour

Any file extension should open in at least the basic text editor.

Actual behaviour

.ps1 files are prompted for download

Server configuration

Default docker from the official page:


volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=
      - MYSQL_PASSWORD=
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    environment:
      - MYSQL_PASSWORD=
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db```
@szaimen szaimen transferred this issue from another repository Jan 6, 2022
@juliusknorr
Copy link
Member

Moving back to server, as text only operates on the mimetype of a file. .ps1 is not a recognized file ending in https://github.com/nextcloud/server/blob/0d2e05a0b57723b9f3dddc3ef2ad59c1844d7697/resources/config/mimetypemapping.dist.json and therefore results in an application/octet-stream mimetype which is then not handled by text.

@juliusknorr juliusknorr transferred this issue from nextcloud/text Jan 10, 2022
@juliusknorr juliusknorr added 1. to develop Accepted and waiting to be taken care of enhancement labels Jan 10, 2022
@LouisSung
Copy link

LouisSung commented Mar 2, 2022

I was dealing with similar issue to make .log files editable when clicked. (related to nextcloud/text#394 ?)
However, I spent an hour to find out that not only the occ maintenance:mimetype:update-js should be run, but also the occ maintenance:mimetype:update-db --repair-filecache!

I figured out the issue by trying to change the .md's mime mapping, and it didn't reflect my changes until the --repair-filecache flag was specified.

Hope this helps : )

see doc: https://docs.nextcloud.com/server/latest/admin_manual/configuration_mimetypes/index.html#mimetype-mapping

@joshtrichards
Copy link
Member

@LouisSung - Are you essentially saying this is a documentation matter? Would you mind clicking on the "Edit in GitHub" link in the upper right of the page you linked to and suggesting a clarification that would help others that encounter the same situation you did? :)

@LouisSung
Copy link

LouisSung commented Sep 5, 2023

@LouisSung - Are you essentially saying this is a documentation matter? Would you mind clicking on the "Edit in GitHub" link in the upper right of the page you linked to and suggesting a clarification that would help others that encounter the same situation you did? :)

Yes if someone just wants to custom the mimetype, such as to ask Nextcloud to recognize an unknown file extension (e.g., to open it in text editor), .log and .md in my case
A repair-filecache is needed to update (reindex?) the database to reflect the change

sure, I have issued a pull request with simple document update
any review and complement are welcome :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement pending documentation This pull request needs an associated documentation update
Projects
None yet
Development

No branches or pull requests

4 participants