mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-21 21:05:05 +00:00
In tag_index(), don't repeat tags in indexes.
This commit is contained in:
parent
75911f5ce9
commit
c165be86c4
1 changed files with 4 additions and 1 deletions
5
data.c
5
data.c
|
@ -1894,6 +1894,7 @@ void tag_index(const char *id, const xs_dict *obj)
|
|||
/* update the tag indexes for this object */
|
||||
{
|
||||
const xs_list *tags = xs_dict_get(obj, "tag");
|
||||
xs *md5_id = xs_md5_hex(id, strlen(id));
|
||||
|
||||
if (is_msg_public(obj) && xs_type(tags) == XSTYPE_LIST && xs_list_len(tags) > 0) {
|
||||
xs *g_tag_dir = xs_fmt("%s/tag", srv_basedir);
|
||||
|
@ -1920,7 +1921,9 @@ void tag_index(const char *id, const xs_dict *obj)
|
|||
mkdirx(tag_dir);
|
||||
|
||||
xs *g_tag_idx = xs_fmt("%s/%s.idx", tag_dir, md5_tag);
|
||||
index_add(g_tag_idx, id);
|
||||
|
||||
if (!index_in_md5(g_tag_idx, md5_id))
|
||||
index_add_md5(g_tag_idx, md5_id);
|
||||
|
||||
FILE *f;
|
||||
xs *g_tag_name = xs_replace(g_tag_idx, ".idx", ".tag");
|
||||
|
|
Loading…
Reference in a new issue