X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/0db97c0d2f4568c2b5b5f5f9b791b8025b4732aa..5e34540b562f91c7b383a307c32e1a159266dd11:/server/cgi.c diff --git a/server/cgi.c b/server/cgi.c index 2189532..5e475ed 100644 --- a/server/cgi.c +++ b/server/cgi.c @@ -585,9 +585,19 @@ const char *cgi_label(const char *key) { read_options(); if(!(label = kvp_get(labels, key))) { - if((label = strchr(key, '.'))) + /* No label found */ + if(!strncmp(key, "images.", 7)) { + static const char *url_static; + /* images.X defaults to X.png */ + + if(!url_static) + url_static = cgi_label("url.static"); + byte_xasprintf((char **)&label, "%s%s.png", url_static, key + 7); + } else if((label = strchr(key, '.'))) + /* X.Y defaults to Y */ ++label; else + /* otherwise default to label name */ label = key; } return label;