Mime: Fix for 0 size files.
This commit is contained in:
parent
4474f3a354
commit
e53f6aa2f1
|
@ -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++)
|
||||
|
|
Loading…
Reference in New Issue