List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH] ui-shared: don't write <link> if favicon unset
@ 2025-08-21 19:46 Christian Barcenas
  0 siblings, 0 replies; only message in thread
From: Christian Barcenas @ 2025-08-21 19:46 UTC (permalink / raw)
  To: cgit

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");

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-21 19:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-21 19:46 [PATCH] ui-shared: don't write <link> if favicon unset Christian Barcenas

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).