mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-24 13:53: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)
|
static const char *get_ext(char const *path)
|
||||||
{
|
{
|
||||||
const char *dot = strrchr(path, '.');
|
const char *base;
|
||||||
if (!dot)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
const char *slash = strrchr(path, '/');
|
if ((base = strrchr(path, '/')))
|
||||||
if (slash && dot < slash)
|
base += sizeof(*base);
|
||||||
|
else
|
||||||
|
base = path;
|
||||||
|
|
||||||
|
const char *dot = strrchr(path, '.');
|
||||||
|
if (!dot || dot == base)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &dot[1];
|
return &dot[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user