Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / assets / linux-debian13.svg
Author[]Andy Green <andy@warmcat.com> 2026-10-04 07:33 UTC
Committer[]Andy Green <andy@warmcat.com> 2026-10-04 20:05 UTC
Tree3e06149e46c6cd4f7d1dcc3efa9d75b124f0fd56   Raw Patch
 
web: status badge reports the project it names
web: status badge reports the project it names

/status/<project> parsed the project name out of the url and passed it to
sai_get_head_status(), which then ignored it: the badge showed the state of
the newest non-ad-hoc event of any project, deleted ones included.

Scope the lookup to the named project and skip deleted events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/src/web/w-comms.c b/src/web/w-comms.c index bb076ff..fa1bd45 100644 --- a/src/web/w-comms.c +++ b/src/web/w-comms.c @@ -91,16 +91,22 @@ static const char * const well_known[] = { int sai_get_head_status(struct vhd *vhd, const char *projname) { + char esc[96], filt[192]; struct lwsac *ac = NULL; lws_dll2_owner_t o; sai_event_t *e; int state; /* - * Ad-hoc events are scratch builds seeded by an admin; they don't - * say anything about the state of the branch, so skip them + * The newest event of the named project decides it. Ad-hoc events + * are scratch builds seeded by an admin; they don't say anything + * about the state of the branch, so skip them, and deleted ones. */ - if (lws_struct_sq3_deserialize(vhd->pdb, " and ifnull(adhoc,0)=0", + lws_sql_purify(esc, projname, sizeof(esc)); + lws_snprintf(filt, sizeof(filt), " and repo_name='%s' and state != %d" + " and ifnull(adhoc,0)=0", esc, SAIES_DELETED); + + if (lws_struct_sq3_deserialize(vhd->pdb, filt, "created ", lsm_schema_sq3_map_event, &o, &ac, 0, -1)) return -1;
Page fetched 0s ago, creation time: 2ms (vhost etag hits: 0%, cache hits: 0%)