snac2

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

commit b5f0b4ba2d45165cc2a70ac5d35d545cb039749d
parent b2b7d9109ba550ed2e3424d1f06be44a6eb1d2a9
Author: default <nobody@localhost>
Date:   Mon, 17 Mar 2025 08:24:37 +0100

Minor tweak.

Diffstat:
Mmastoapi.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mastoapi.c b/mastoapi.c @@ -2125,9 +2125,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, xs *current = xs_dict_new(); if (xs_startswith(v, "https://") && xs_startswith((xs_mime_by_ext(v)), "image/")) { /* remove first and last colon */ - char *shortcode = (char *)k; - shortcode[strlen(k) - 1] = '\0'; - current = xs_dict_append(current, "shortcode", shortcode + 1); + xs *shortcode = xs_replace(k, ":", ""); + current = xs_dict_append(current, "shortcode", shortcode); current = xs_dict_append(current, "url", v); current = xs_dict_append(current, "static_url", v); current = xs_dict_append(current, "visible_in_picker", xs_stock(XSTYPE_TRUE));