diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Skip an indented comment in the mimetype file
Only a hash in the first column marked a comment, so an indented one was read as the type "#" for every word after it. The manual already describes comments by their first non-blank character.
Diffstat (limited to '')
-rw-r--r--source/shared.c4
1 file changed, 1 insertion, 3 deletions
diff --git a/source/shared.c b/source/shared.c
index 84ee4c8..a5c54ee 100644
--- a/source/shared.c
+++ b/source/shared.c
@@ -724,13 +724,11 @@ char *cgit_get_mimetype_for_filename(const char *filename)
if (!file)
return NULL;
while (fgets(line, sizeof(line), file)) {
- if (!line[0] || line[0] == '#')
- continue;
// A line of a mime.types file is one type followed by every
// extension that maps to it.
string_list_split_in_place(&fields, line, " \t\r\n", -1);
string_list_remove_empty_items(&fields, 0);
- if (!fields.nr) {
+ if (!fields.nr || fields.items[0].string[0] == '#') {
string_list_clear(&fields, 0);
continue;
}