List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 2/3] ui-shared: URL-escape script_name
Date: Sun, 12 Jan 2014 19:45:16 +0000	[thread overview]
Message-ID: <743715d4d544aac87ea7707e47eef6e115f908f5.1389555852.git.john@keeping.me.uk> (raw)
In-Reply-To: <432e1f40c0d887db602ec9411ae16c45896a54f5.1389555852.git.john@keeping.me.uk>

As far as I know, there is no requirement that $SCRIPT_NAME contain only
URL-safe characters, so we need to make sure that any special characters
are escaped.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 ui-shared.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index 2c12de7..abe15cd 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -139,7 +139,7 @@ static void site_url(const char *page, const char *search, const char *sort, int
 	if (ctx.cfg.virtual_root)
 		html_attr(ctx.cfg.virtual_root);
 	else
-		html(ctx.cfg.script_name);
+		html_url_path(ctx.cfg.script_name);
 
 	if (page) {
 		htmlf("?p=%s", page);
@@ -219,7 +219,7 @@ static char *repolink(const char *title, const char *class, const char *page,
 				html_url_path(path);
 		}
 	} else {
-		html(ctx.cfg.script_name);
+		html_url_path(ctx.cfg.script_name);
 		html("?url=");
 		html_url_arg(ctx.repo->url);
 		if (ctx.repo->url[strlen(ctx.repo->url) - 1] != '/')
-- 
1.8.5.226.g0d60d77



  reply	other threads:[~2014-01-12 19:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12 19:45 [PATCH 1/3] ui-refs: escape HTML chars in author and tagger names john
2014-01-12 19:45 ` john [this message]
2014-01-12 21:18   ` [PATCH 2/3] ui-shared: URL-escape script_name Jason
2014-01-12 22:00     ` john
2014-01-12 19:45 ` [PATCH 3/3] ui-repolist: HTML-escape cgit_rooturl() response john
2014-01-12 22:03   ` Jason
2014-01-12 22:02 ` [PATCH 1/3] ui-refs: escape HTML chars in author and tagger names Jason
2014-01-12 22:17   ` john

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=743715d4d544aac87ea7707e47eef6e115f908f5.1389555852.git.john@keeping.me.uk \
    --to=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).