Skip to content

Commit

Permalink
Allow new documents (zero size files) to open. (#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypw committed Jun 13, 2024
1 parent 6ae813a commit 3f353c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Services/Document.vala
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,11 @@ namespace Scratch.Services {
this.working = true;

var content_type = ContentType.from_mime_type (mime_type);

if (!force && !(ContentType.is_a (content_type, "text/plain"))) {
if (!(
force
|| ContentType.is_a (content_type, "text/plain")
|| ContentType.is_a (content_type, "application/x-zerosize") // Empty files are valid text files
)) {
var title = _("%s Is Not a Text File").printf (get_basename ());
var description = _("Code will not load this type of file.");
var alert_view = new Granite.Widgets.AlertView (title, description, "dialog-warning");
Expand Down

0 comments on commit 3f353c1

Please sign in to comment.