diff options
| author | 2023-11-01 18:54:21 +0100 | |
|---|---|---|
| committer | 2023-11-01 18:54:21 +0100 | |
| commit | 770fc331fd32273a89c3e8178a7d15a98f0443ed (patch) | |
| tree | 556a58176f37d68e9b510216b130230d3af1003e | |
| parent | Backport from xs. (diff) | |
| download | snac2-770fc331fd32273a89c3e8178a7d15a98f0443ed.tar.gz snac2-770fc331fd32273a89c3e8178a7d15a98f0443ed.tar.xz snac2-770fc331fd32273a89c3e8178a7d15a98f0443ed.zip | |
Use an md5 instead of a fixed file name in avatars and headers.
| -rw-r--r-- | html.c | 3 |
1 files changed, 2 insertions, 1 deletions
| @@ -2590,7 +2590,8 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 2590 | 2590 | ||
| 2591 | if (xs_startswith(mimetype, "image/")) { | 2591 | if (xs_startswith(mimetype, "image/")) { |
| 2592 | const char *ext = strrchr(fn, '.'); | 2592 | const char *ext = strrchr(fn, '.'); |
| 2593 | xs *id = xs_fmt("%s%s", uploads[n], ext); | 2593 | xs *hash = xs_md5_hex(fn, strlen(fn)); |
| 2594 | xs *id = xs_fmt("%s%s", hash, ext); | ||
| 2594 | xs *url = xs_fmt("%s/s/%s", snac.actor, id); | 2595 | xs *url = xs_fmt("%s/s/%s", snac.actor, id); |
| 2595 | int fo = xs_number_get(xs_list_get(uploaded_file, 1)); | 2596 | int fo = xs_number_get(xs_list_get(uploaded_file, 1)); |
| 2596 | int fs = xs_number_get(xs_list_get(uploaded_file, 2)); | 2597 | int fs = xs_number_get(xs_list_get(uploaded_file, 2)); |