Fix compatible file checking

What does this MR do and why?

  • Fix issue where files would incorrectly be classified as not able to be opened by missing mimetypes.
  • Attempt to unicodedecode 4kb of a file as a sample to see if we can open it. Mark as not openable if we get a unicodedecode error
  • Add override to open a file marked as "can_open=False" by holding alt and left clicking the file.
  • Fix unsupported file type message in editor.
  • Resolves #653 (closed)

Screenshots or screen recordings

image

How to set up and validate locally

  1. Name a file with the json5 extension.
  2. Try to open it in the Crafty browser.

---Test override---

  1. Alt press on a jar file. It should open the editor and an error will appear, but at least we were able to try to open it /shrug.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

  • Have you checked this doesn't interfere/conflict/duplicate someone elses work?
  • Have you fully tested your changes?
  • Have you resolved any lint issues?
  • Have you assigned a reviewer?
  • Have you applied correct labels?
Edited by Andrew

Merge request reports

Loading