aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Lidén Borell2023-01-07 10:32:07 +0100
committerYigit Sever2023-07-21 03:04:19 +0300
commitb6ffc623fec1149c2be40ce94e160b2a5c542bf4 (patch)
tree0daa7e279f7c1691914866ca452c451ac65ddfa0
parent2dcb46a217e141d949dbce66ee79201658cfb391 (diff)
downloadcgit-b6ffc623fec1149c2be40ce94e160b2a5c542bf4.tar.gz
cgit-b6ffc623fec1149c2be40ce94e160b2a5c542bf4.tar.bz2
cgit-b6ffc623fec1149c2be40ce94e160b2a5c542bf4.zip
config: make empty js= omit script tag
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 <samuel@kodafritt.se> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--ui-shared.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 959ed8b..25bd3f4 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -770,6 +770,10 @@ static void print_rel_vcs_link(const char *url)
770 770
771static int emit_css_link(struct string_list_item *s, void *arg) 771static int emit_css_link(struct string_list_item *s, void *arg)
772{ 772{
773 /* Do not emit anything if css= is specified. */
774 if (s && *s->string == '\0')
775 return 0;
776
773 html("<link rel='stylesheet' type='text/css' href='"); 777 html("<link rel='stylesheet' type='text/css' href='");
774 if (s) 778 if (s)
775 html_attr(s->string); 779 html_attr(s->string);
@@ -782,6 +786,10 @@ static int emit_css_link(struct string_list_item *s, void *arg)
782 786
783static int emit_js_link(struct string_list_item *s, void *arg) 787static int emit_js_link(struct string_list_item *s, void *arg)
784{ 788{
789 /* Do not emit anything if js= is specified. */
790 if (s && *s->string == '\0')
791 return 0;
792
785 html("<script type='text/javascript' src='"); 793 html("<script type='text/javascript' src='");
786 if (s) 794 if (s)
787 html_attr(s->string); 795 html_attr(s->string);