mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-28 07:23:07 +01:00
Fix: add check for hidden files in get_ext()
This commit is contained in:
parent
1f460e2de1
commit
7f0ea955c4
13
ctpv.c
13
ctpv.c
@ -59,12 +59,15 @@ static const char *get_mimetype(char const *path)
|
||||
|
||||
static const char *get_ext(char const *path)
|
||||
{
|
||||
const char *dot = strrchr(path, '.');
|
||||
if (!dot)
|
||||
return NULL;
|
||||
const char *base;
|
||||
|
||||
const char *slash = strrchr(path, '/');
|
||||
if (slash && dot < slash)
|
||||
if ((base = strrchr(path, '/')))
|
||||
base += sizeof(*base);
|
||||
else
|
||||
base = path;
|
||||
|
||||
const char *dot = strrchr(path, '.');
|
||||
if (!dot || dot == base)
|
||||
return NULL;
|
||||
|
||||
return &dot[1];
|
||||
|
Loading…
Reference in New Issue
Block a user