{"thread":{"id":"10332","subject":"[PATCH] gitweb: Provide title attributes for abbreviated author names.","startedAt":"2007-10-17T00:34:37Z","lastAt":"2007-10-21T04:29:16Z","messageCount":3,"participants":["David Symonds","Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"56159","messageId":"1192581277533-git-send-email-dsymonds@gmail.com","threadId":"10332","inReplyTo":null,"subject":"[PATCH] gitweb: Provide title attributes for abbreviated author names.","fromName":"David Symonds","fromEmail":"dsymonds@gmail.com","sentAt":"2007-10-17T00:34:37Z","receivedAt":"2007-10-17T00:34:37Z","isPatch":true,"sender":{"key":"dsymonds@gmail.com","avatar":"https://gravatar.com/avatar/b22f5051cbfc11836e36cf7a690e6cde4e225d835e13295ff98d15c7a9ee3c0f?d=mp&s=160"},"body":"Signed-off-by: David Symonds <dsymonds@gmail.com>\n---\n gitweb/gitweb.perl |   34 +++++++++++++++++++++++++++++-----\n 1 files changed, 29 insertions(+), 5 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b2bae1b..3112fd4 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -3461,9 +3461,15 @@ sub git_shortlog_body {\n \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n \t\t}\n \t\t$alternate ^= 1;\n+\t\tmy $author = chop_str($co{'author_name'}, 10);\n+\t\tif ($author ne $co{'author_name'}) {\n+\t\t\t$author = \"<span title=\\\"$co{'author_name'}\\\">\" . esc_html($author) . \"</span>\";\n+\t\t} else {\n+\t\t\t$author = esc_html($author);\n+\t\t}\n \t\t# git_summary() used print \"<td><i>$co{'age_string'}</i></td>\\n\" .\n \t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n-\t\t      \"<td><i>\" . esc_html(chop_str($co{'author_name'}, 10)) . \"</i></td>\\n\" .\n+\t\t      \"<td><i>\" . $author . \"</i></td>\\n\" .\n \t\t      \"<td>\";\n \t\tprint format_subject_html($co{'title'}, $co{'title_short'},\n \t\t                          href(action=>\"commit\", hash=>$commit), $ref);\n@@ -3511,9 +3517,15 @@ sub git_history_body {\n \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n \t\t}\n \t\t$alternate ^= 1;\n+\t# shortlog uses      chop_str($co{'author_name'}, 10)\n+\t\tmy $author = chop_str($co{'author_name'}, 15, 3);\n+\t\tif ($author ne $co{'author_name'}) {\n+\t\t\t\"<span title=\\\"$co{'author_name'}\\\">\" . esc_html($author) . \"</span>\";\n+\t\t} else {\n+\t\t\t$author = esc_html($author);\n+\t\t}\n \t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n-\t\t      # shortlog uses      chop_str($co{'author_name'}, 10)\n-\t\t      \"<td><i>\" . esc_html(chop_str($co{'author_name'}, 15, 3)) . \"</i></td>\\n\" .\n+\t\t      \"<td><i>\" . $author . \"</i></td>\\n\" .\n \t\t      \"<td>\";\n \t\t# originally git_history used chop_str($co{'title'}, 50)\n \t\tprint format_subject_html($co{'title'}, $co{'title_short'},\n@@ -3667,8 +3679,14 @@ sub git_search_grep_body {\n \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n \t\t}\n \t\t$alternate ^= 1;\n+\t\tmy $author = chop_str($co{'author_name'}, 15, 5);\n+\t\tif ($author ne $co{'author_name'}) {\n+\t\t\t$author = \"<span title=\\\"$co{'author_name'}\\\">\" . esc_html($author) . \"</span>\";\n+\t\t} else {\n+\t\t\t$author = esc_html($author);\n+\t\t}\n \t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n-\t\t      \"<td><i>\" . esc_html(chop_str($co{'author_name'}, 15, 5)) . \"</i></td>\\n\" .\n+\t\t      \"<td><i>\" . $author . \"</i></td>\\n\" .\n \t\t      \"<td>\" .\n \t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$co{'id'}), -class => \"list subject\"},\n \t\t\t       esc_html(chop_str($co{'title'}, 50)) . \"<br/>\");\n@@ -5181,8 +5199,14 @@ sub git_search {\n \t\t\t\t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n \t\t\t\t\t}\n \t\t\t\t\t$alternate ^= 1;\n+\t\t\t\t\tmy $author = chop_str($co{'author_name'}, 15, 5);\n+\t\t\t\t\tif ($author ne $co{'author_name'}) {\n+\t\t\t\t\t\t$author = \"<span title=\\\"$co{'author_name'}\\\">\" . esc_html($author) . \"</span>\";\n+\t\t\t\t\t} else {\n+\t\t\t\t\t\t$author = esc_html($author);\n+\t\t\t\t\t}\n \t\t\t\t\tprint \"<td title=\\\"$co{'age_string_age'}\\\"><i>$co{'age_string_date'}</i></td>\\n\" .\n-\t\t\t\t\t      \"<td><i>\" . esc_html(chop_str($co{'author_name'}, 15, 5)) . \"</i></td>\\n\" .\n+\t\t\t\t\t      \"<td><i>\" . $author . \"</i></td>\\n\" .\n \t\t\t\t\t      \"<td>\" .\n \t\t\t\t\t      $cgi->a({-href => href(action=>\"commit\", hash=>$co{'id'}),\n \t\t\t\t\t              -class => \"list subject\"},\n-- \n1.5.3.1\n"},{"id":"56742","messageId":"20071021032533.GA30717@spearce.org","threadId":"10332","inReplyTo":"1192581277533-git-send-email-dsymonds@gmail.com","subject":"Re: [PATCH] gitweb: Provide title attributes for abbreviated author names.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-21T03:25:33Z","receivedAt":"2007-10-21T03:25:33Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Nice, but...\n\nDavid Symonds <dsymonds@gmail.com> wrote:\n> +++ b/gitweb/gitweb.perl\n> @@ -3461,9 +3461,15 @@ sub git_shortlog_body {\n>  \t\t\tprint \"<tr class=\\\"light\\\">\\n\";\n>  \t\t}\n>  \t\t$alternate ^= 1;\n> +\t\tmy $author = chop_str($co{'author_name'}, 10);\n> +\t\tif ($author ne $co{'author_name'}) {\n> +\t\t\t$author = \"<span title=\\\"$co{'author_name'}\\\">\" . esc_html($author) . \"</span>\";\n\nDoesn't this produce invalid HTML if $co{'author_name'} has a special\nHTML character in it such as & or \"?  Note that \" is much more likely\nas it is often used for nicknames.  The old code properly escaped\nthe author name, and indeed you are doing it for the abbreviated\nversion but not the full version.\n\nThis bug seemed to exist in almost all (if not all) of the hunks.\n\n-- \nShawn.\n"},{"id":"56745","messageId":"ee77f5c20710202129t7f60aebbib24d91ba360f64a2@mail.gmail.com","threadId":"10332","inReplyTo":"20071021032533.GA30717@spearce.org","subject":"Re: [PATCH] gitweb: Provide title attributes for abbreviated author names.","fromName":"David Symonds","fromEmail":"dsymonds@gmail.com","sentAt":"2007-10-21T04:29:16Z","receivedAt":"2007-10-21T04:29:16Z","isPatch":true,"sender":{"key":"dsymonds@gmail.com","avatar":"https://gravatar.com/avatar/b22f5051cbfc11836e36cf7a690e6cde4e225d835e13295ff98d15c7a9ee3c0f?d=mp&s=160"},"body":"On 21/10/2007, Shawn O. Pearce <spearce@spearce.org> wrote:\n> Nice, but...\n>\n> David Symonds <dsymonds@gmail.com> wrote:\n> > +++ b/gitweb/gitweb.perl\n> > @@ -3461,9 +3461,15 @@ sub git_shortlog_body {\n> >                       print \"<tr class=\\\"light\\\">\\n\";\n> >               }\n> >               $alternate ^= 1;\n> > +             my $author = chop_str($co{'author_name'}, 10);\n> > +             if ($author ne $co{'author_name'}) {\n> > +                     $author = \"<span title=\\\"$co{'author_name'}\\\">\" . esc_html($author) . \"</span>\";\n>\n> Doesn't this produce invalid HTML if $co{'author_name'} has a special\n> HTML character in it such as & or \"?  Note that \" is much more likely\n> as it is often used for nicknames.  The old code properly escaped\n> the author name, and indeed you are doing it for the abbreviated\n> version but not the full version.\n\nSure, I'll fix it up and resend. I might even refactor some code at\nthe same time.\n\n\nDave.\n"}]}