summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html.c2
-rw-r--r--mastoapi.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/html.c b/html.c
index 3d213a2..56dc2cc 100644
--- a/html.c
+++ b/html.c
@@ -4362,7 +4362,7 @@ int html_post_handler(const xs_dict *req, const char *q_path,
4362 xs_rnd_buf(rnd, sizeof(rnd)); 4362 xs_rnd_buf(rnd, sizeof(rnd));
4363 4363
4364 const char *ext = strrchr(fn, '.'); 4364 const char *ext = strrchr(fn, '.');
4365 xs *hash = xs_md5_hex(rnd, strlen(rnd)); 4365 xs *hash = xs_md5_hex(rnd, sizeof(rnd));
4366 xs *id = xs_fmt("post-%s%s", hash, ext ? ext : ""); 4366 xs *id = xs_fmt("post-%s%s", hash, ext ? ext : "");
4367 xs *url = xs_fmt("%s/s/%s", snac.actor, id); 4367 xs *url = xs_fmt("%s/s/%s", snac.actor, id);
4368 int fo = xs_number_get(xs_list_get(attach_file, 1)); 4368 int fo = xs_number_get(xs_list_get(attach_file, 1));
diff --git a/mastoapi.c b/mastoapi.c
index df713a8..27c476e 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -2978,8 +2978,10 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path,
2978 2978
2979 if (*fn != '\0') { 2979 if (*fn != '\0') {
2980 char *ext = strrchr(fn, '.'); 2980 char *ext = strrchr(fn, '.');
2981 xs *hash = xs_md5_hex(fn, strlen(fn)); 2981 char rnd[32];
2982 xs *id = xs_fmt("%s%s", hash, ext); 2982 xs_rnd_buf(rnd, sizeof(rnd));
2983 xs *hash = xs_md5_hex(rnd, sizeof(rnd));
2984 xs *id = xs_fmt("post-%s%s", hash, ext ? ext : "");
2983 xs *url = xs_fmt("%s/s/%s", snac.actor, id); 2985 xs *url = xs_fmt("%s/s/%s", snac.actor, id);
2984 int fo = xs_number_get(xs_list_get(file, 1)); 2986 int fo = xs_number_get(xs_list_get(file, 1));
2985 int fs = xs_number_get(xs_list_get(file, 2)); 2987 int fs = xs_number_get(xs_list_get(file, 2));