1
0
Эх сурвалжийг харах

The avatar and header images have a prefix in their names.

default 1 жил өмнө
parent
commit
6f884e0d5d
1 өөрчлөгдсөн 3 нэмэгдсэн , 3 устгасан
  1. 3 3
      html.c

+ 3 - 3
html.c

@@ -4290,9 +4290,9 @@ int html_post_handler(const xs_dict *req, const char *q_path,
                     char rnd[32];
                     char rnd[32];
                     xs_rnd_buf(rnd, sizeof(rnd));
                     xs_rnd_buf(rnd, sizeof(rnd));
 
 
-                    char *ext = strrchr(fn, '.');
+                    const char *ext = strrchr(fn, '.');
                     xs *hash  = xs_md5_hex(rnd, strlen(rnd));
                     xs *hash  = xs_md5_hex(rnd, strlen(rnd));
-                    xs *id    = xs_fmt("p-%s%s", hash, ext ? ext : "");
+                    xs *id    = xs_fmt("post-%s%s", hash, ext ? ext : "");
                     xs *url   = xs_fmt("%s/s/%s", snac.actor, id);
                     xs *url   = xs_fmt("%s/s/%s", snac.actor, id);
                     int fo    = xs_number_get(xs_list_get(attach_file, 1));
                     int fo    = xs_number_get(xs_list_get(attach_file, 1));
                     int fs    = xs_number_get(xs_list_get(attach_file, 2));
                     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,
                     if (xs_startswith(mimetype, "image/")) {
                     if (xs_startswith(mimetype, "image/")) {
                         const char *ext = strrchr(fn, '.');
                         const char *ext = strrchr(fn, '.');
                         xs *hash        = xs_md5_hex(fn, strlen(fn));
                         xs *hash        = xs_md5_hex(fn, strlen(fn));
-                        xs *id          = xs_fmt("%s%s", hash, ext);
+                        xs *id          = xs_fmt("%s-%s%s", uploads[n], hash, ext ? ext : "");
                         xs *url         = xs_fmt("%s/s/%s", snac.actor, id);
                         xs *url         = xs_fmt("%s/s/%s", snac.actor, id);
                         int fo          = xs_number_get(xs_list_get(uploaded_file, 1));
                         int fo          = xs_number_get(xs_list_get(uploaded_file, 1));
                         int fs          = xs_number_get(xs_list_get(uploaded_file, 2));
                         int fs          = xs_number_get(xs_list_get(uploaded_file, 2));