Skip to content
  • Allison Karlitskaya's avatar
    GLocalFile: return text/plain for empty files · 202a9c34
    Allison Karlitskaya authored
    Previously, GLib returned text/plain for empty files.
    
    This is important because people may want to open empty (eg:
    just-created) text files with the text editor.
    
    An unintended side-effect of b6fc1df0
    caused GLib to start returning application/octet-stream instead of
    text/plain for these files.
    
    This commit is essentially a revert of that commit, with a different
    solution: we move the special-case up a bit in the function and
    hard-code it to text/plain.
    
    This change does not exactly maintain the old behaviour: previously, a
    "fast" lookup would have returned application/octet-stream on an empty
    file and now it will return text/plain.  I consider this to be an
    improvement (since we're returning better data) and don't expect it to
    cause problems.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755795
    202a9c34