diff options
| author | rako <m@rako.space> | 2025-11-28 10:37:49 +0100 |
|---|---|---|
| committer | rako <m@rako.space> | 2025-11-30 21:19:13 +0100 |
| commit | a45c1ce152011e8fe25eb1d25594ac5705f65404 (patch) | |
| tree | 93c9f3f9dc187fe7aa38e882879f72353b273925 /html.c | |
| parent | 46bb87c2b54c9b9d9a4cd462b47158ede1eec170 (diff) | |
Fix user matching
In order to be a proper prefix, the actor url must end with a '/'
otherwise it can match another user that starts with the same prefix:
for example 'testuser' will match anything made by 'testuser2'
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1898,7 +1898,7 @@ xs_html *html_entry_controls(snac *user, const char *actor, xs_html_attr("name", "redir"), xs_html_attr("value", redir)))); - if (!xs_startswith(id, user->actor)) { + if (!is_msg_mine(user, id)) { if (xs_list_in(likes, user->md5) == -1) { /* not already liked; add button */ xs_html_add(form, @@ -2426,7 +2426,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only, if (read_only) closed = 1; /* non-identified page; show as closed */ else - if (user && xs_startswith(id, user->actor)) + if (user && is_msg_mine(user, id)) closed = 1; /* we questioned; closed for us */ else if (user && was_question_voted(user, id)) @@ -5022,7 +5022,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, } else { /* delete an entry */ - if (xs_startswith(id, snac.actor) && !is_draft(&snac, id)) { + if (is_msg_mine(&snac, id) && !is_draft(&snac, id)) { /* it's a post by us: generate a delete */ xs *msg = msg_delete(&snac, id); |