commit 770fc33

default  ·  2023-11-01 17:54:21 +0000 UTC
parent 922e0bc
Use an md5 instead of a fixed file name in avatars and headers.
1 files changed,  +2, -1
M html.c
M html.c
+2, -1
 1@@ -2590,7 +2590,8 @@ int html_post_handler(const xs_dict *req, const char *q_path,
 2 
 3                     if (xs_startswith(mimetype, "image/")) {
 4                         const char *ext = strrchr(fn, '.');
 5-                        xs *id          = xs_fmt("%s%s", uploads[n], ext);
 6+                        xs *hash        = xs_md5_hex(fn, strlen(fn));
 7+                        xs *id          = xs_fmt("%s%s", hash, ext);
 8                         xs *url         = xs_fmt("%s/s/%s", snac.actor, id);
 9                         int fo          = xs_number_get(xs_list_get(uploaded_file, 1));
10                         int fs          = xs_number_get(xs_list_get(uploaded_file, 2));