diff options
author | Samuel Lidén Borell <samuel@kodafritt.se> | 2023-01-07 10:32:07 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-01-10 17:52:54 +0100 |
commit | 00ecfaadea2c40cc62b7a43e246384329e6ddb98 (patch) | |
tree | d49073f892df4fcd785defc8c3d9afddd6fb4fcb /ui-shared.c | |
parent | 907134b7a29177cb45aa461c549c004b1ae875af (diff) | |
download | cgit-00ecfaadea2c40cc62b7a43e246384329e6ddb98.tar.gz cgit-00ecfaadea2c40cc62b7a43e246384329e6ddb98.tar.xz |
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>
Diffstat (limited to 'ui-shared.c')
-rw-r--r-- | ui-shared.c | 8 |
1 files changed, 8 insertions, 0 deletions
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) html_attr(s->string); @@ -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) html_attr(s->string); |