List for cgit developers and users
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <>
Cc: "Jason A . Donenfeld" <>
Subject: [PATCH v2] config: make empty js= omit script tag
Date: Tue, 10 Jan 2023 17:53:40 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Samuel Lidén Borell <>

According to the cgitrc man page, an empty js= value should cause the
script tag to be omitted. But instead, a script tag with an empty URL
is emitted. The same applies to css. So, skip emitting a tag if the
specified string is empty.

Signed-off-by: Samuel Lidén Borell <>
Signed-off-by: Jason A. Donenfeld <>
 ui-shared.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/ui-shared.c b/ui-shared.c
index 11aed19..baea6f2 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -770,6 +770,10 @@ static void print_rel_vcs_link(const char *url)
 static int emit_css_link(struct string_list_item *s, void *arg)
+	/* Do not emit anything if css= is specified. */
+	if (s && *s->string == '\0')
+		return 0;
 	html("<link rel='stylesheet' type='text/css' href='");
 	if (s)
@@ -782,6 +786,10 @@ static int emit_css_link(struct string_list_item *s, void *arg)
 static int emit_js_link(struct string_list_item *s, void *arg)
+	/* Do not emit anything if js= is specified. */
+	if (s && *s->string == '\0')
+		return 0;
 	html("<script type='text/javascript' src='");
 	if (s)

  reply	other threads:[~2023-01-10 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 11:38 [PATCH] config: Make " Samuel Lidén Borell
2023-01-10 16:50 ` Jason A. Donenfeld
2023-01-10 16:53   ` Jason A. Donenfeld [this message]
2023-01-10 18:53     ` [PATCH v2] config: make " Samuel Lidén Borell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).