Skip to content

Commit

Permalink
gitweb: Fix bug in insert_file() subroutine
Browse files Browse the repository at this point in the history
In insert_file() subroutine (which is used to insert HTML fragments as
custom header, footer, hometext (for projects list view), and per
project README.html (for summary view)) we used:

     map(to_utf8, <$fd>);

This doesn't work, and other form has to be used:

     map { to_utf8($_) } <$fd>;

Now with test for t9600 added, for $GIT_DIR/README.html.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jakub Narebski authored and Junio C Hamano committed Dec 8, 2008
1 parent e10ea81 commit 4586864
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -2764,7 +2764,7 @@ sub insert_file {
my $filename = shift;

open my $fd, '<', $filename;
print map(to_utf8, <$fd>);
print map { to_utf8($_) } <$fd>;
close $fd;
}

Expand Down
10 changes: 10 additions & 0 deletions t/t9500-gitweb-standalone-no-errors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -673,4 +673,14 @@ test_expect_success \
gitweb_run "p=.git;a=tree"'
test_debug 'cat gitweb.log'

# ----------------------------------------------------------------------
# non-ASCII in README.html

test_expect_success \
'README.html with non-ASCII characters (utf-8)' \
'echo "<b>UTF-8 example:</b><br />" > .git/README.html &&
cat "$TEST_DIRECTORY"/t3900/1-UTF-8.txt >> .git/README.html &&
gitweb_run "p=.git;a=summary"'
test_debug 'cat gitweb.log'

test_done

0 comments on commit 4586864

Please sign in to comment.