From 08c743202adfdf0c0381e6d246bfaca4d0c16ede Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 29 Feb 2008 09:49:08 +0000 Subject: [PATCH] Make sure empty files get text/plain type (#518720) 2008-02-29 Alexander Larsson * glocalfileinfo.c: (get_content_type): Make sure empty files get text/plain type (#518720) svn path=/trunk/; revision=6605 --- gio/ChangeLog | 6 ++++++ gio/glocalfileinfo.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 0a3435a9e..af71aaa9c 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,9 @@ +2008-02-29 Alexander Larsson + + * glocalfileinfo.c: + (get_content_type): + Make sure empty files get text/plain type (#518720) + 2008-02-27 Alexander Larsson * gcontenttype.c: diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 9c4538c11..4553ded1b 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -1215,7 +1215,7 @@ get_content_type (const char *basename, res = read (fd, sniff_buffer, sniff_length); close (fd); - if (res > 0) + if (res >= 0) { g_free (content_type); content_type = g_content_type_guess (basename, sniff_buffer, res, NULL);