Skip to content

gio: Change content type of zero-sized files to application/x-zerosize

Philip Withnall requested to merge wip/pwithnall/2777-zerosize into main

That’s what xdgmime uses for zero-sized files (see XDG_MIME_TYPE_EMPTY).

Historically, GLib explicitly used text/plain for empty files, to ensure they would open in a text editor. But text/plain is not really correct for an empty file: the content isn’t text because there is no content. The file could eventually become something else when written to.

Text editors which want to be opened for new, empty files should add application/x-zerosize to their list of supported content types.

Users who want to set a handler for application/x-zerosize on their desktop should use

gio mime application/x-zerosize  # to see the current handler
gio mime application/x-zerosize org.gnome.gedit.desktop  # to set it

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Fixes: #2777 (closed)

Merge request reports