Thread (25 messages) 25 messages, 3 authors, 2016-06-15

Re: [PATCHv2 GSOC 06/11] gitweb: Create Gitweb::Escape module

flat view

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:49:08

On Thu, 15 Jul 2010, Pavan Kumar Sunkara wrote:
Create a Gitweb::Escape module in 'gitweb/lib/Gitweb/Escape.pm'
to store all the quoting/unquoting and escaping subroutines
regarding the gitweb.perl script.

This module imports $fallback_encoding variable from
Gitweb::Config module to use it in sub 'to_utf8'

Subroutines moved:
	to_utf8
	esc_param
	esc_url
	esc_html
	esc_path
	quot_cec
	quot_upr
	untabify

Update gitweb/Makefile to install Gitweb::Escape module alongside gitweb
Nice and straightforward refactoring.

For what it is worth, ACK from me.

[...]
quoted hunk ↗ jump to hunk
+# quote unsafe chars, but keep the slash, even when it's not
+# correct, but quoted slashes look too horrible in bookmarks
+sub esc_param {
+	my $str = shift;
+	return undef unless defined $str;
+	$str =~ s/([^A-Za-z0-9\-_.~()\/:@ ]+)/CGI::escape($1)/eg;
+	$str =~ s/ /\+/g;
+	return $str;
+}
+
+# quote unsafe chars in whole URL, so some charactrs cannot be quoted
+sub esc_url {
+	my $str = shift;
+	return undef unless defined $str;
+	$str =~ s/([^A-Za-z0-9\-_.~();\/;?:@&= ]+)/CGI::escape($1)/eg;
+	$str =~ s/ /\+/g;
+	return $str;
+}
I see that here (or rather in corresponding preimage) you have dependency
on first patch in series, i.e. "gitweb: fix esc_url".

If you had send first patch as a separate email, not as part of series,
you would have need to mention in cover letter that the series (without
first patch) is based on / requires "gitweb: fix esc_url".

-- 
Jakub Narebski
Poland
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help