summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorJakub Narebski <jnareb@gmail.com>2010-02-07 20:51:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-17 19:18:09 (GMT)
commit453541fcfcbc54aa3b0035667e5d5885d407d0a5 (patch)
tree5233260f999c7a0f5f5f73c02339243bf24b9158 /gitweb
parent6d816301cd53e54af3398b634d47588a6f184be4 (diff)
downloadgit-453541fcfcbc54aa3b0035667e5d5885d407d0a5.zip
git-453541fcfcbc54aa3b0035667e5d5885d407d0a5.tar.gz
git-453541fcfcbc54aa3b0035667e5d5885d407d0a5.tar.bz2
gitweb: esc_html (short) error message in die_error
The error message (second argument to die_error) is meant to be short, one-line text description of given error. A few callers call die_error with error message containing unescaped user supplied data ($hash, $file_name). Instead of forcing callers to escape data, simply call esc_html on the parameter. Note that optional third parameter, which contains detailed error description, is meant to be HTML formatted, and therefore should be not escaped. While at it update esc_html synopsis/usage, and bring default error description to read 'Internal Server Error' (titlecased). Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl4
1 files changed, 2 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1f6978a..2ccbb6a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3372,7 +3372,7 @@ sub git_footer_html {
"</html>";
}
-# die_error(<http_status_code>, <error_message>)
+# die_error(<http_status_code>, <error_message>[, <detailed_html_description>])
# Example: die_error(404, 'Hash not found')
# By convention, use the following status codes (as defined in RFC 2616):
# 400: Invalid or missing CGI parameters, or
@@ -3387,7 +3387,7 @@ sub git_footer_html {
# or down for maintenance). Generally, this is a temporary state.
sub die_error {
my $status = shift || 500;
- my $error = shift || "Internal server error";
+ my $error = esc_html(shift || "Internal Server Error");
my $extra = shift;
my %http_responses = (