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 new documents (zero size files) to open. #1437

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading