From: Christian Barcenas <christian@cbarcenas.com>
To: cgit@lists.zx2c4.com
Subject: [PATCH] ui-shared: don't write <link> if favicon unset
Date: Thu, 21 Aug 2025 14:46:33 -0500 [thread overview]
Message-ID: <CAJMok+a6B4-GmCyjg8EqrP-CUxPsq1zRUPAFRHyiM+g4TjJqJg@mail.gmail.com> (raw)
Since the favicon setting defaults to "/favicon.ico", the user can
only unset it with favicon=. However, that would write an empty string
as the config value. Previously, such empty string always satisfied
the if condition. In this case it is better to omit the <link> entirely.
Signed-off-by: Christian Barcenas <christian@cbarcenas.com>
diff --git a/ui-shared.c b/ui-shared.c
index 6fae72d..3c33600 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -832,7 +832,7 @@ void cgit_print_docstart(void)
else
emit_js_link(NULL, "/cgit.js");
- if (ctx.cfg.favicon) {
+ if (ctx.cfg.favicon && *ctx.cfg.favicon) {
html("<link rel='shortcut icon' href='");
html_attr(ctx.cfg.favicon);
html("'/>\n");
reply other threads:[~2025-08-21 19:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJMok+a6B4-GmCyjg8EqrP-CUxPsq1zRUPAFRHyiM+g4TjJqJg@mail.gmail.com \
--to=christian@cbarcenas.com \
--cc=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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).