summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'data.c')
-rw-r--r--data.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/data.c b/data.c
index eb4c9d5..0fd3528 100644
--- a/data.c
+++ b/data.c
@@ -136,6 +136,18 @@ int srv_open(const char *basedir, int auto_upgrade)
136 srv_proxy_token_seed = xs_hex_enc(rnd, sizeof(rnd)); 136 srv_proxy_token_seed = xs_hex_enc(rnd, sizeof(rnd));
137 } 137 }
138 138
139 /* ensure user directories include important subdirectories */
140 xs *users = user_list();
141 const char *uid;
142
143 xs_list_foreach(users, uid) {
144 xs *impdir = xs_fmt("%s/user/%s/import", srv_basedir, uid);
145 xs *expdir = xs_fmt("%s/user/%s/export", srv_basedir, uid);
146
147 mkdirx(impdir);
148 mkdirx(expdir);
149 }
150
139 return ret; 151 return ret;
140} 152}
141 153
@@ -2705,6 +2717,11 @@ xs_list *content_search(snac *user, const char *regex,
2705 if (id == NULL || is_hidden(user, id)) 2717 if (id == NULL || is_hidden(user, id))
2706 continue; 2718 continue;
2707 2719
2720 /* recalculate the md5 id to be sure it's not repeated
2721 (it may have been searched by the "url" field instead of "id") */
2722 xs *new_md5 = xs_md5_hex(id, strlen(id));
2723 md5 = new_md5;
2724
2708 /* test for the post URL */ 2725 /* test for the post URL */
2709 if (strcmp(id, regex) == 0) { 2726 if (strcmp(id, regex) == 0) {
2710 if (xs_set_add(&seen, md5) == 1) 2727 if (xs_set_add(&seen, md5) == 1)