Skip to content

Commit 57017b3

Browse files
warthog9gitster
authored andcommitted
gitweb: Simplify (and fix) chop_str
The chop_str subroutine is meant to be used on strings (such as commit description / title) *before* HTML escaping, which means before applying esc_html or equivalent. Therefore get rid of the failed attempt to always remove full HTML entities (like e.g. &amp; or &nbsp;). It is not necessary (HTML entities gets added later), and it can cause chop_str to chop a string incorrectly. Specifically: API & protocol: support option to force written data immediately to disk from http://git.kernel.org/?p=daemon/distsrv/chunkd.git;a=commit;h=3b02f749df2cb1288f345a689d85e7061f507e54 The short version of the title gets chopped to API ... where it should be API & protocol: support option to force written data... Noticed-by: John 'Warthog9' Hawley <[email protected]> Signed-off-by: John 'Warthog9' Hawley <[email protected]> Signed-off-by: Jakub Narebski <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7928610 commit 57017b3

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

gitweb/gitweb.perl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,6 @@ sub chop_str {
13301330
$str =~ m/^(.*?)($begre)$/;
13311331
my ($lead, $body) = ($1, $2);
13321332
if (length($lead) > 4) {
1333-
$body =~ s/^[^;]*;// if ($lead =~ m/&[^;]*$/);
13341333
$lead = " ...";
13351334
}
13361335
return "$lead$body";
@@ -1341,8 +1340,6 @@ sub chop_str {
13411340
$str =~ m/^(.*?)($begre)$/;
13421341
my ($mid, $right) = ($1, $2);
13431342
if (length($mid) > 5) {
1344-
$left =~ s/&[^;]*$//;
1345-
$right =~ s/^[^;]*;// if ($mid =~ m/&[^;]*$/);
13461343
$mid = " ... ";
13471344
}
13481345
return "$left$mid$right";
@@ -1352,7 +1349,6 @@ sub chop_str {
13521349
my $body = $1;
13531350
my $tail = $2;
13541351
if (length($tail) > 4) {
1355-
$body =~ s/&[^;]*$//;
13561352
$tail = "... ";
13571353
}
13581354
return "$body$tail";

0 commit comments

Comments
 (0)