diff options
| -rw-r--r-- | src/loader.c | 9 | ||||
| -rw-r--r-- | tests/check_loader.c | 4 | 
2 files changed, 8 insertions, 5 deletions
| diff --git a/src/loader.c b/src/loader.c index 8f04dae..5cd24df 100644 --- a/src/loader.c +++ b/src/loader.c @@ -141,11 +141,14 @@ blogc_source_parse_from_files(b_trie_t *conf, b_slist_t *l, blogc_error_t **err)                  b_trie_free(s);                  continue;              } -            char **tags = b_str_split(tags_str, ',', 0); +            char **tags = b_str_split(tags_str, ' ', 0);              bool found = false; -            for (unsigned int i = 0; tags[i] != NULL; i++) -                if (0 == strcmp(b_str_strip(tags[i]), filter_tag)) +            for (unsigned int i = 0; tags[i] != NULL; i++) { +                if (tags[i][0] == '\0') +                    continue; +                if (0 == strcmp(tags[i], filter_tag))                      found = true; +            }              b_strv_free(tags);              if (!found) {                  b_trie_free(s); diff --git a/tests/check_loader.c b/tests/check_loader.c index f5be3e7..03f0ef1 100644 --- a/tests/check_loader.c +++ b/tests/check_loader.c @@ -478,7 +478,7 @@ test_source_parse_from_files_filter_by_page_and_tag(void **state)      will_return(__wrap_blogc_file_get_contents, b_strdup(          "ASD: 789\n"          "DATE: 2003-02-03 04:05:06\n" -        "TAGS: chunda, bola\n" +        "TAGS: chunda bola\n"          "--------\n"          "bola"));      will_return(__wrap_blogc_file_get_contents, "bola4.txt"); @@ -505,7 +505,7 @@ test_source_parse_from_files_filter_by_page_and_tag(void **state)      will_return(__wrap_blogc_file_get_contents, b_strdup(          "ASD: 7894\n"          "DATE: 2007-02-03 04:05:06\n" -        "TAGS: yay, chunda\n" +        "TAGS: yay chunda\n"          "--------\n"          "bola"));      blogc_error_t *err = NULL; | 
