snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 770fc331fd32273a89c3e8178a7d15a98f0443ed
parent 922e0bc919b424db8b55ff79a2603342b7f35f02
Author: default <nobody@localhost>
Date:   Wed,  1 Nov 2023 18:54:21 +0100

Use an md5 instead of a fixed file name in avatars and headers.

Diffstat:
Mhtml.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/html.c b/html.c @@ -2590,7 +2590,8 @@ int html_post_handler(const xs_dict *req, const char *q_path, if (xs_startswith(mimetype, "image/")) { const char *ext = strrchr(fn, '.'); - xs *id = xs_fmt("%s%s", uploads[n], ext); + xs *hash = xs_md5_hex(fn, strlen(fn)); + xs *id = xs_fmt("%s%s", hash, ext); xs *url = xs_fmt("%s/s/%s", snac.actor, id); int fo = xs_number_get(xs_list_get(uploaded_file, 1)); int fs = xs_number_get(xs_list_get(uploaded_file, 2));