summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar default2025-04-06 07:50:51 +0200
committerGravatar default2025-04-06 07:50:51 +0200
commit6f884e0d5d4eb9be41764c5ae16da52fed997e88 (patch)
tree5bdaea6008da151ef0a5a56771691f8073d80c9c
parentPost attachments now have random names. (diff)
downloadpenes-snac2-6f884e0d5d4eb9be41764c5ae16da52fed997e88.tar.gz
penes-snac2-6f884e0d5d4eb9be41764c5ae16da52fed997e88.tar.xz
penes-snac2-6f884e0d5d4eb9be41764c5ae16da52fed997e88.zip
The avatar and header images have a prefix in their names.
-rw-r--r--html.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/html.c b/html.c
index 9ff5625..a598038 100644
--- a/html.c
+++ b/html.c
@@ -4290,9 +4290,9 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4290 char rnd[32]; 4290 char rnd[32];
4291 xs_rnd_buf(rnd, sizeof(rnd)); 4291 xs_rnd_buf(rnd, sizeof(rnd));
4292 4292
4293 char *ext = strrchr(fn, '.'); 4293 const char *ext = strrchr(fn, '.');
4294 xs *hash = xs_md5_hex(rnd, strlen(rnd)); 4294 xs *hash = xs_md5_hex(rnd, strlen(rnd));
4295 xs *id = xs_fmt("p-%s%s", hash, ext ? ext : ""); 4295 xs *id = xs_fmt("post-%s%s", hash, ext ? ext : "");
4296 xs *url = xs_fmt("%s/s/%s", snac.actor, id); 4296 xs *url = xs_fmt("%s/s/%s", snac.actor, id);
4297 int fo = xs_number_get(xs_list_get(attach_file, 1)); 4297 int fo = xs_number_get(xs_list_get(attach_file, 1));
4298 int fs = xs_number_get(xs_list_get(attach_file, 2)); 4298 int fs = xs_number_get(xs_list_get(attach_file, 2));
@@ -4764,7 +4764,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4764 if (xs_startswith(mimetype, "image/")) { 4764 if (xs_startswith(mimetype, "image/")) {
4765 const char *ext = strrchr(fn, '.'); 4765 const char *ext = strrchr(fn, '.');
4766 xs *hash = xs_md5_hex(fn, strlen(fn)); 4766 xs *hash = xs_md5_hex(fn, strlen(fn));
4767 xs *id = xs_fmt("%s%s", hash, ext); 4767 xs *id = xs_fmt("%s-%s%s", uploads[n], hash, ext ? ext : "");
4768 xs *url = xs_fmt("%s/s/%s", snac.actor, id); 4768 xs *url = xs_fmt("%s/s/%s", snac.actor, id);
4769 int fo = xs_number_get(xs_list_get(uploaded_file, 1)); 4769 int fo = xs_number_get(xs_list_get(uploaded_file, 1));
4770 int fs = xs_number_get(xs_list_get(uploaded_file, 2)); 4770 int fs = xs_number_get(xs_list_get(uploaded_file, 2));