From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31032 invoked from network); 10 Jan 2023 16:54:05 -0000 Received: from lists.zx2c4.com (165.227.139.114) by inbox.vuxu.org with ESMTPUTF8; 10 Jan 2023 16:54:05 -0000 Received: by lists.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 397e9873; Tue, 10 Jan 2023 16:53:54 +0000 (UTC) Return-Path: Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lists.zx2c4.com (ZX2C4 Mail Server) with ESMTPS id 5a4b9e93 (TLSv1.2:ECDHE-ECDSA-AES256-GCM-SHA384:256:NO) for ; Tue, 10 Jan 2023 16:53:53 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A8F5861795; Tue, 10 Jan 2023 16:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A14A4C433EF; Tue, 10 Jan 2023 16:53:50 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="mudyGAfG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1673369628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4DCLUUGOFsTU7ZY1YmA90Xu3oPxwJ2E671rcBVvrPU4=; b=mudyGAfGMMpdUQ1XXZyywCe5syEtpcR/fR5/3eMDo8qSmJY80oqvtJtrxY0WE0PKY/Wj3E x2Q1M3IaeYtlXrgqxwWxlU2i9M+CNfWXq6FWs84jIkcwimLKJqp+EmYH2BObXnHgYKd1UE owaK7PTaMLDi5A9Fs0kcC8vh/afRkL0= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id aa98ca5e (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 10 Jan 2023 16:53:48 +0000 (UTC) From: "Jason A. Donenfeld" To: samuel@kodafritt.se, cgit@lists.zx2c4.com Cc: "Jason A . Donenfeld" Subject: [PATCH v2] config: make empty js= omit script tag Date: Tue, 10 Jan 2023 17:53:40 +0100 Message-Id: <20230110165340.27837-1-Jason@zx2c4.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: cgit@lists.zx2c4.com X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: List for cgit developers and users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: cgit-bounces@lists.zx2c4.com Sender: "CGit" 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("