{"thread":{"id":"43617","subject":"[PATCH] gitweb: Do not use esc_html in esc_path","startedAt":"2006-11-25T08:43:59Z","lastAt":"2006-11-25T09:54:04Z","messageCount":3,"participants":["Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"296004","messageId":"11644442392444-git-send-email-jnareb@gmail.com","threadId":"43617","inReplyTo":null,"subject":"[PATCH] gitweb: Do not use esc_html in esc_path","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-25T08:43:59Z","receivedAt":"2006-11-25T08:43:59Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Do not use esc_html in esc_path subroutine to avoid double quoting;\nexpand esc_html body (except quoting) in esc_path.\n\nMove esc_path before quot_cec and quot_upr. Add some comments.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThis patch was send to git mailing list; I don't know if it\nwas missed, or rejected.\n\n gitweb/gitweb.perl |   28 +++++++++++++++++-----------\n 1 files changed, 17 insertions(+), 11 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex ce185d9..53214b0 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -585,7 +585,21 @@ sub esc_html ($;%) {\n \treturn $str;\n }\n \n-# Make control characterss \"printable\".\n+# quote control characters and escape filename to HTML\n+sub esc_path {\n+\tmy $str = shift;\n+\tmy %opts = @_;\n+\n+\t$str = to_utf8($str);\n+\t$str = escapeHTML($str);\n+\tif ($opts{'-nbsp'}) {\n+\t\t$str =~ s/ /&nbsp;/g;\n+\t}\n+\t$str =~ s|([[:cntrl:]])|quot_cec($1)|eg;\n+\treturn $str;\n+}\n+\n+# Make control characters \"printable\", using character escape codes (CEC)\n sub quot_cec {\n \tmy $cntrl = shift;\n \tmy %es = ( # character escape codes, aka escape sequences\n@@ -605,22 +619,14 @@ sub quot_cec {\n \treturn \"<span class=\\\"cntrl\\\">$chr</span>\";\n }\n \n-# Alternatively use unicode control pictures codepoints.\n+# Alternatively use unicode control pictures codepoints,\n+# Unicode \"printable representation\" (PR)\n sub quot_upr {\n \tmy $cntrl = shift;\n \tmy $chr = sprintf('&#%04d;', 0x2400+ord($cntrl));\n \treturn \"<span class=\\\"cntrl\\\">$chr</span>\";\n }\n \n-# quote control characters and escape filename to HTML\n-sub esc_path {\n-\tmy $str = shift;\n-\n-\t$str = esc_html($str);\n-\t$str =~ s|([[:cntrl:]])|quot_cec($1)|eg;\n-\treturn $str;\n-}\n-\n # git may return quoted and escaped filenames\n sub unquote {\n \tmy $str = shift;\n-- \n1.4.3.4\n"},{"id":"296086","messageId":"7v3b876esd.fsf@assigned-by-dhcp.cox.net","threadId":"43617","inReplyTo":"11644442392444-git-send-email-jnareb@gmail.com","subject":"Re: [PATCH] gitweb: Do not use esc_html in esc_path","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-25T09:45:06Z","receivedAt":"2006-11-25T09:45:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Do not use esc_html in esc_path subroutine to avoid double quoting;\n> expand esc_html body (except quoting) in esc_path.\n>\n> Move esc_path before quot_cec and quot_upr. Add some comments.\n>\n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> ---\n> This patch was send to git mailing list; I don't know if it\n> was missed, or rejected.\n\nI do not remember looking at it deeply, so probably it was just\nlost in the noise.\n\nUnless there was a list discussion that was unfavorable, that\nis; but I do not recall one and the patch looks sane.\n\n"},{"id":"296912","messageId":"200611251054.04295.jnareb@gmail.com","threadId":"43617","inReplyTo":"7v3b876esd.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] gitweb: Do not use esc_html in esc_path","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-11-25T09:54:04Z","receivedAt":"2006-11-25T09:54:04Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n>\n>> ---\n>> This patch was send to git mailing list; I don't know if it\n>> was missed, or rejected.\n> \n> I do not remember looking at it deeply, so probably it was just\n> lost in the noise.\n> \n> Unless there was a list discussion that was unfavorable, that\n> is; but I do not recall one and the patch looks sane.\n\nThere was no discussion, so probably the patch was just lost in the \nnoise. It happens.\n-- \nJakub Narebski\n"}]}