Mime: Fix for 0 size files.

This commit is contained in:
Alastair Poole 2019-12-29 00:53:24 +00:00
parent 4474f3a354
commit e53f6aa2f1
1 changed files with 7 additions and 8 deletions

View File

@ -23,6 +23,13 @@ edi_mime_type_get(const char *path)
f = eina_file_open(path, EINA_FALSE);
if (!f) return efreet_mime_type_get(path);
len = eina_file_size_get(f);
if (!len)
{
eina_file_close(f);
return "text/plain";
}
map = eina_file_map_all(f, EINA_FILE_POPULATE);
if (!map)
{
@ -30,14 +37,6 @@ edi_mime_type_get(const char *path)
return efreet_mime_type_get(path);
}
len = eina_file_size_get(f);
if (!len)
{
eina_file_map_free(f, map);
eina_file_close(f);
return "text/plain";
}
if (len > 2048) len = 2048;
for (int i = 0; i < (int) len; i++)