summaryrefslogtreecommitdiff
path: root/src/libtipidee/tipidee_conf_get_content_type.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2024-04-25 12:03:12 +0000
committerLaurent Bercot <ska@appnovation.com>2024-04-25 12:03:12 +0000
commita56299c15302e82c89595d7ed0f4770536362b6a (patch)
treec6327d71a4fa24b0ab8c808e8050b9cee9720bb0 /src/libtipidee/tipidee_conf_get_content_type.c
parent10b51a9f02e8b37e1cfc8283a0773d6c5e443314 (diff)
downloadtipidee-a56299c15302e82c89595d7ed0f4770536362b6a.tar.xz
Prepare for 0.0.5.0; accept "" as empty extension for content-type
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libtipidee/tipidee_conf_get_content_type.c')
-rw-r--r--src/libtipidee/tipidee_conf_get_content_type.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libtipidee/tipidee_conf_get_content_type.c b/src/libtipidee/tipidee_conf_get_content_type.c
index 7ee8866..98e9f5d 100644
--- a/src/libtipidee/tipidee_conf_get_content_type.c
+++ b/src/libtipidee/tipidee_conf_get_content_type.c
@@ -7,16 +7,17 @@
char const *tipidee_conf_get_content_type (tipidee_conf const *conf, char const *res)
{
+ char const *value = 0 ;
char const *ext = strrchr(res, '.') ;
if (ext && !strchr(ext, '/'))
{
- char const *value = 0 ;
size_t extlen = strlen(ext+1) ;
char key[3 + extlen] ;
key[0] = 'T' ; key[1] = ':' ;
memcpy(key + 2, ext + 1, extlen + 1) ;
value = tipidee_conf_get_string(conf, key) ;
- if (value || errno != ENOENT) return value ;
}
+ else value = tipidee_conf_get_string(conf, "T:") ;
+ if (value || errno != ENOENT) return value ;
return "application/octet-stream" ;
}