dshoreman / servidor

A modern web application for managing servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Check for MIME types before opening files

dshoreman opened this issue · comments

When you try to open an image or some other binary file, it dies with an encoding error.

A list of supported MIME types should be added and referenced when loading files. If the file exists and is readable, but its MIME isn't a supported type, we should return a 'Unsupported filetype' error.

Example Supported Filetypes

While we're just dumping the file contents into a <pre></pre> block, we can't really display images or anything other than text. There are a few varieties though, so it's worth making sure we have all of 'em. Just a couple examples are:

  • text/csv
  • text/css
  • text/plain
  • text/markdown
  • application/x-sh
  • application/json
  • application/javascript
  • text/javascript

Further Reference: Incomplete list of MIME types