{"thread":{"id":"53842","subject":"[PATCH] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","startedAt":"2020-07-11T21:02:16Z","lastAt":"2020-11-20T15:40:23Z","messageCount":10,"participants":["Tobias Girstmair","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"401400","messageId":"20200711203947.23520-1-tobi@isticktoit.net","threadId":"53842","inReplyTo":null,"subject":"[PATCH] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-07-11T20:39:48Z","receivedAt":"2020-07-11T21:02:16Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"using a base tag has the side-effect of not just changing the few URLs\nof gitweb's static resources, but all other relative links (e.g. those\nin a README.html), too.\n\nSigned-off-by: Tobias Girstmair <tobi@isticktoit.net>\n---\nMy exact use case is this: Many of my repositories have README.{rst,md}\nfiles with relative links to more md/rst files. I'm generating a\nREADME.html from that file with a post-update hook, and rewrite links,\nso they display the file. Some cloned repos' READMEs even have images in\nthem, whose links I'm fixing up as well.\n\nDue to the precence of the <base> tag, I can't just prepend\n\"blob_plain/HEAD:\" to the URLs, but have to recreate the full URL,\nincluding the last few directories of $GIT_DIR. That's annoying to keep\nportable (move a repo from e.g. /srv/git/foo.git to\n/srv/git/**public**/foo.git and the URL must be changed in the hook, and\nthe hook re-executed).\n\nLooking forward to your feedback,\n\ttobias\n\n gitweb/gitweb.perl | 30 ++++++++++++++++--------------\n 1 file changed, 16 insertions(+), 14 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0959a78..049bb64 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -2232,7 +2232,7 @@ sub git_get_avatar {\n \t\treturn $pre_white .\n \t\t       \"<img width=\\\"$size\\\" \" .\n \t\t            \"class=\\\"avatar\\\" \" .\n-\t\t            \"src=\\\"\".esc_url($url).\"\\\" \" .\n+\t\t            \"src=\\\"\".get_base_url().esc_url($url).\"\\\" \" .\n \t\t\t    \"alt=\\\"\\\" \" .\n \t\t       \"/>\" . $post_white;\n \t} else {\n@@ -2674,6 +2674,13 @@ sub get_feed_info {\n \treturn %res;\n }\n \n+# the stylesheet, favicon etc urls won't work correctly with path_info\n+# unless we set the appropriate base URL. not using a <base> tag to not\n+# also change relative URLs inserted by the user.\n+sub get_base_url {\n+\treturn $ENV{'PATH_INFO'}? esc_url($base_url).\"/\" : \"\";\n+}\n+\n ## ----------------------------------------------------------------------\n ## git utility subroutines, invoking git commands\n \n@@ -4099,17 +4106,17 @@ sub print_header_links {\n \t# print out each stylesheet that exist, providing backwards capability\n \t# for those people who defined $stylesheet in a config file\n \tif (defined $stylesheet) {\n-\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url($stylesheet).'\"/>'.\"\\n\";\n+\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.get_base_url().esc_url($stylesheet).'\"/>'.\"\\n\";\n \t} else {\n \t\tforeach my $stylesheet (@stylesheets) {\n \t\t\tnext unless $stylesheet;\n-\t\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url($stylesheet).'\"/>'.\"\\n\";\n+\t\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.get_base_url().esc_url($stylesheet).'\"/>'.\"\\n\";\n \t\t}\n \t}\n \tprint_feed_meta()\n \t\tif ($status eq '200 OK');\n \tif (defined $favicon) {\n-\t\tprint qq(<link rel=\"shortcut icon\" href=\").esc_url($favicon).qq(\" type=\"image/png\" />\\n);\n+\t\tprint qq(<link rel=\"shortcut icon\" href=\").get_base_url().esc_url($favicon).qq(\" type=\"image/png\" />\\n);\n \t}\n }\n \n@@ -4212,11 +4219,6 @@ sub git_header_html {\n <meta name=\"robots\" content=\"index, nofollow\"/>\n <title>$title</title>\n EOF\n-\t# the stylesheet, favicon etc urls won't work correctly with path_info\n-\t# unless we set the appropriate base URL\n-\tif ($ENV{'PATH_INFO'}) {\n-\t\tprint \"<base href=\\\"\".esc_url($base_url).\"\\\" />\\n\";\n-\t}\n \tprint_header_links($status);\n \n \tif (defined $site_html_head_string) {\n@@ -4234,7 +4236,7 @@ sub git_header_html {\n \tif (defined $logo) {\n \t\tprint $cgi->a({-href => esc_url($logo_url),\n \t\t               -title => $logo_label},\n-\t\t              $cgi->img({-src => esc_url($logo),\n+\t\t              $cgi->img({-src => get_base_url().esc_url($logo),\n \t\t                         -width => 72, -height => 27,\n \t\t                         -alt => \"git\",\n \t\t                         -class => \"logo\"}));\n@@ -4299,7 +4301,7 @@ sub git_footer_html {\n \t\tinsert_file($site_footer);\n \t}\n \n-\tprint qq!<script type=\"text/javascript\" src=\"!.esc_url($javascript).qq!\"></script>\\n!;\n+\tprint qq!<script type=\"text/javascript\" src=\"!.get_base_url().esc_url($javascript).qq!\"></script>\\n!;\n \tif (defined $action &&\n \t    $action eq 'blame_incremental') {\n \t\tprint qq!<script type=\"text/javascript\">\\n!.\n@@ -8273,7 +8275,7 @@ sub git_feed {\n \t\tif (defined $logo || defined $favicon) {\n \t\t\t# prefer the logo to the favicon, since RSS\n \t\t\t# doesn't allow both\n-\t\t\tmy $img = esc_url($logo || $favicon);\n+\t\t\tmy $img = get_base_url().esc_url($logo || $favicon);\n \t\t\tprint \"<image>\\n\" .\n \t\t\t      \"<url>$img</url>\\n\" .\n \t\t\t      \"<title>$title</title>\\n\" .\n@@ -8299,11 +8301,11 @@ sub git_feed {\n \t\t      # use project owner for feed author\n \t\t      \"<author><name>$owner</name></author>\\n\";\n \t\tif (defined $favicon) {\n-\t\t\tprint \"<icon>\" . esc_url($favicon) . \"</icon>\\n\";\n+\t\t\tprint \"<icon>\" . get_base_url() . esc_url($favicon) . \"</icon>\\n\";\n \t\t}\n \t\tif (defined $logo) {\n \t\t\t# not twice as wide as tall: 72 x 27 pixels\n-\t\t\tprint \"<logo>\" . esc_url($logo) . \"</logo>\\n\";\n+\t\t\tprint \"<logo>\" . get_base_url() . esc_url($logo) . \"</logo>\\n\";\n \t\t}\n \t\tif (! %latest_date) {\n \t\t\t# dummy date to keep the feed valid until commits trickle in:\n-- \n2.21.3\n\n"},{"id":"401419","messageId":"20200712182418.1696-1-tobi@isticktoit.net","threadId":"53842","inReplyTo":"20200711203947.23520-1-tobi@isticktoit.net","subject":"[PATCH v2] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-07-12T18:24:19Z","receivedAt":"2020-07-12T18:57:58Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"using a base tag has the side-effect of not just changing the few URLs\nof gitweb's static resources, but all other relative links (e.g. those\nin a README.html), too.\n\nSigned-off-by: Tobias Girstmair <tobi@isticktoit.net>\n---\nIn v1 of this patch I didn't think about already absolute URLs. Fixed.\n\n\ttobias\n\n gitweb/gitweb.perl | 36 ++++++++++++++++++++++--------------\n 1 file changed, 22 insertions(+), 14 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0959a78..6a4f2fa 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1616,6 +1616,19 @@ sub esc_url {\n \treturn $str;\n }\n \n+# the stylesheet, favicon etc urls won't work correctly with path_info\n+# unless we set the appropriate base URL. not using a <base> tag to not\n+# also change relative URLs inserted by the user.\n+sub esc_url_base {\n+\tmy $url = shift;\n+\tmy $prefix = $ENV{'PATH_INFO'}? esc_url($base_url).\"/\" : \"\";\n+\tif (url !~ m{^(https?:)?//?}) {\n+\t\treturn $prefix . esc_url($url);\n+\t} else {\n+\t\treturn esc_url($url);\n+\t}\n+}\n+\n # quote unsafe characters in HTML attributes\n sub esc_attr {\n \n@@ -2232,7 +2245,7 @@ sub git_get_avatar {\n \t\treturn $pre_white .\n \t\t       \"<img width=\\\"$size\\\" \" .\n \t\t            \"class=\\\"avatar\\\" \" .\n-\t\t            \"src=\\\"\".esc_url($url).\"\\\" \" .\n+\t\t            \"src=\\\"\".esc_url_base($url).\"\\\" \" .\n \t\t\t    \"alt=\\\"\\\" \" .\n \t\t       \"/>\" . $post_white;\n \t} else {\n@@ -4099,17 +4112,17 @@ sub print_header_links {\n \t# print out each stylesheet that exist, providing backwards capability\n \t# for those people who defined $stylesheet in a config file\n \tif (defined $stylesheet) {\n-\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url($stylesheet).'\"/>'.\"\\n\";\n+\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url_base($stylesheet).'\"/>'.\"\\n\";\n \t} else {\n \t\tforeach my $stylesheet (@stylesheets) {\n \t\t\tnext unless $stylesheet;\n-\t\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url($stylesheet).'\"/>'.\"\\n\";\n+\t\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url_base($stylesheet).'\"/>'.\"\\n\";\n \t\t}\n \t}\n \tprint_feed_meta()\n \t\tif ($status eq '200 OK');\n \tif (defined $favicon) {\n-\t\tprint qq(<link rel=\"shortcut icon\" href=\").esc_url($favicon).qq(\" type=\"image/png\" />\\n);\n+\t\tprint qq(<link rel=\"shortcut icon\" href=\").esc_url_base($favicon).qq(\" type=\"image/png\" />\\n);\n \t}\n }\n \n@@ -4212,11 +4225,6 @@ sub git_header_html {\n <meta name=\"robots\" content=\"index, nofollow\"/>\n <title>$title</title>\n EOF\n-\t# the stylesheet, favicon etc urls won't work correctly with path_info\n-\t# unless we set the appropriate base URL\n-\tif ($ENV{'PATH_INFO'}) {\n-\t\tprint \"<base href=\\\"\".esc_url($base_url).\"\\\" />\\n\";\n-\t}\n \tprint_header_links($status);\n \n \tif (defined $site_html_head_string) {\n@@ -4234,7 +4242,7 @@ sub git_header_html {\n \tif (defined $logo) {\n \t\tprint $cgi->a({-href => esc_url($logo_url),\n \t\t               -title => $logo_label},\n-\t\t              $cgi->img({-src => esc_url($logo),\n+\t\t              $cgi->img({-src => esc_url_base($logo),\n \t\t                         -width => 72, -height => 27,\n \t\t                         -alt => \"git\",\n \t\t                         -class => \"logo\"}));\n@@ -4299,7 +4307,7 @@ sub git_footer_html {\n \t\tinsert_file($site_footer);\n \t}\n \n-\tprint qq!<script type=\"text/javascript\" src=\"!.esc_url($javascript).qq!\"></script>\\n!;\n+\tprint qq!<script type=\"text/javascript\" src=\"!.esc_url_base($javascript).qq!\"></script>\\n!;\n \tif (defined $action &&\n \t    $action eq 'blame_incremental') {\n \t\tprint qq!<script type=\"text/javascript\">\\n!.\n@@ -8273,7 +8281,7 @@ sub git_feed {\n \t\tif (defined $logo || defined $favicon) {\n \t\t\t# prefer the logo to the favicon, since RSS\n \t\t\t# doesn't allow both\n-\t\t\tmy $img = esc_url($logo || $favicon);\n+\t\t\tmy $img = esc_url_base($logo || $favicon);\n \t\t\tprint \"<image>\\n\" .\n \t\t\t      \"<url>$img</url>\\n\" .\n \t\t\t      \"<title>$title</title>\\n\" .\n@@ -8299,11 +8307,11 @@ sub git_feed {\n \t\t      # use project owner for feed author\n \t\t      \"<author><name>$owner</name></author>\\n\";\n \t\tif (defined $favicon) {\n-\t\t\tprint \"<icon>\" . esc_url($favicon) . \"</icon>\\n\";\n+\t\t\tprint \"<icon>\" . esc_url_base($favicon) . \"</icon>\\n\";\n \t\t}\n \t\tif (defined $logo) {\n \t\t\t# not twice as wide as tall: 72 x 27 pixels\n-\t\t\tprint \"<logo>\" . esc_url($logo) . \"</logo>\\n\";\n+\t\t\tprint \"<logo>\" . esc_url_base($logo) . \"</logo>\\n\";\n \t\t}\n \t\tif (! %latest_date) {\n \t\t\t# dummy date to keep the feed valid until commits trickle in:\n-- \n2.21.3\n\n"},{"id":"401420","messageId":"20200712183329.3358-1-tobi@isticktoit.net","threadId":"53842","inReplyTo":"20200711203947.23520-1-tobi@isticktoit.net","subject":"[PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-07-12T18:33:30Z","receivedAt":"2020-07-12T19:11:30Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"using a base tag has the side-effect of not just changing the few URLs\nof gitweb's static resources, but all other relative links (e.g. those\nin a README.html), too.\n\nSigned-off-by: Tobias Girstmair <tobi@isticktoit.net>\n---\nApologies; missed a typo.\n\n\ttobias\n\n gitweb/gitweb.perl | 36 ++++++++++++++++++++++--------------\n 1 file changed, 22 insertions(+), 14 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0959a78..f426060 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1616,6 +1616,19 @@ sub esc_url {\n \treturn $str;\n }\n \n+# the stylesheet, favicon etc urls won't work correctly with path_info\n+# unless we set the appropriate base URL. not using a <base> tag to not\n+# also change relative URLs inserted by the user.\n+sub esc_url_base {\n+\tmy $url = shift;\n+\tmy $prefix = $ENV{'PATH_INFO'}? esc_url($base_url).\"/\" : \"\";\n+\tif ($url !~ m{^(https?:)?//?}) {\n+\t\treturn $prefix . esc_url($url);\n+\t} else {\n+\t\treturn esc_url($url);\n+\t}\n+}\n+\n # quote unsafe characters in HTML attributes\n sub esc_attr {\n \n@@ -2232,7 +2245,7 @@ sub git_get_avatar {\n \t\treturn $pre_white .\n \t\t       \"<img width=\\\"$size\\\" \" .\n \t\t            \"class=\\\"avatar\\\" \" .\n-\t\t            \"src=\\\"\".esc_url($url).\"\\\" \" .\n+\t\t            \"src=\\\"\".esc_url_base($url).\"\\\" \" .\n \t\t\t    \"alt=\\\"\\\" \" .\n \t\t       \"/>\" . $post_white;\n \t} else {\n@@ -4099,17 +4112,17 @@ sub print_header_links {\n \t# print out each stylesheet that exist, providing backwards capability\n \t# for those people who defined $stylesheet in a config file\n \tif (defined $stylesheet) {\n-\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url($stylesheet).'\"/>'.\"\\n\";\n+\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url_base($stylesheet).'\"/>'.\"\\n\";\n \t} else {\n \t\tforeach my $stylesheet (@stylesheets) {\n \t\t\tnext unless $stylesheet;\n-\t\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url($stylesheet).'\"/>'.\"\\n\";\n+\t\t\tprint '<link rel=\"stylesheet\" type=\"text/css\" href=\"'.esc_url_base($stylesheet).'\"/>'.\"\\n\";\n \t\t}\n \t}\n \tprint_feed_meta()\n \t\tif ($status eq '200 OK');\n \tif (defined $favicon) {\n-\t\tprint qq(<link rel=\"shortcut icon\" href=\").esc_url($favicon).qq(\" type=\"image/png\" />\\n);\n+\t\tprint qq(<link rel=\"shortcut icon\" href=\").esc_url_base($favicon).qq(\" type=\"image/png\" />\\n);\n \t}\n }\n \n@@ -4212,11 +4225,6 @@ sub git_header_html {\n <meta name=\"robots\" content=\"index, nofollow\"/>\n <title>$title</title>\n EOF\n-\t# the stylesheet, favicon etc urls won't work correctly with path_info\n-\t# unless we set the appropriate base URL\n-\tif ($ENV{'PATH_INFO'}) {\n-\t\tprint \"<base href=\\\"\".esc_url($base_url).\"\\\" />\\n\";\n-\t}\n \tprint_header_links($status);\n \n \tif (defined $site_html_head_string) {\n@@ -4234,7 +4242,7 @@ sub git_header_html {\n \tif (defined $logo) {\n \t\tprint $cgi->a({-href => esc_url($logo_url),\n \t\t               -title => $logo_label},\n-\t\t              $cgi->img({-src => esc_url($logo),\n+\t\t              $cgi->img({-src => esc_url_base($logo),\n \t\t                         -width => 72, -height => 27,\n \t\t                         -alt => \"git\",\n \t\t                         -class => \"logo\"}));\n@@ -4299,7 +4307,7 @@ sub git_footer_html {\n \t\tinsert_file($site_footer);\n \t}\n \n-\tprint qq!<script type=\"text/javascript\" src=\"!.esc_url($javascript).qq!\"></script>\\n!;\n+\tprint qq!<script type=\"text/javascript\" src=\"!.esc_url_base($javascript).qq!\"></script>\\n!;\n \tif (defined $action &&\n \t    $action eq 'blame_incremental') {\n \t\tprint qq!<script type=\"text/javascript\">\\n!.\n@@ -8273,7 +8281,7 @@ sub git_feed {\n \t\tif (defined $logo || defined $favicon) {\n \t\t\t# prefer the logo to the favicon, since RSS\n \t\t\t# doesn't allow both\n-\t\t\tmy $img = esc_url($logo || $favicon);\n+\t\t\tmy $img = esc_url_base($logo || $favicon);\n \t\t\tprint \"<image>\\n\" .\n \t\t\t      \"<url>$img</url>\\n\" .\n \t\t\t      \"<title>$title</title>\\n\" .\n@@ -8299,11 +8307,11 @@ sub git_feed {\n \t\t      # use project owner for feed author\n \t\t      \"<author><name>$owner</name></author>\\n\";\n \t\tif (defined $favicon) {\n-\t\t\tprint \"<icon>\" . esc_url($favicon) . \"</icon>\\n\";\n+\t\t\tprint \"<icon>\" . esc_url_base($favicon) . \"</icon>\\n\";\n \t\t}\n \t\tif (defined $logo) {\n \t\t\t# not twice as wide as tall: 72 x 27 pixels\n-\t\t\tprint \"<logo>\" . esc_url($logo) . \"</logo>\\n\";\n+\t\t\tprint \"<logo>\" . esc_url_base($logo) . \"</logo>\\n\";\n \t\t}\n \t\tif (! %latest_date) {\n \t\t\t# dummy date to keep the feed valid until commits trickle in:\n-- \n2.21.3\n\n"},{"id":"401424","messageId":"xmqqmu44phym.fsf@gitster.c.googlers.com","threadId":"53842","inReplyTo":"20200712183329.3358-1-tobi@isticktoit.net","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-12T21:00:01Z","receivedAt":"2020-07-12T21:00:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tobias Girstmair <tobi@isticktoit.net> writes:\n\n> using a base tag has the side-effect of not just changing the few URLs\n> of gitweb's static resources, but all other relative links (e.g. those\n> in a README.html), too.\n\nSorry, but I am not sure the description is understandable to the\nintended readers of this sentence.\n\nWhere does this README.html come from?  \n\nIs it stored in the history of the repository as a blob, and sent to\nthe browser with a call to git_blob_plain() sub?  Wouldn't that\ncodepath send the untrusted end-user data as an attachment, in which\ncase relative links in the blob do not get resolved relative to the\nbase URL anyway, no?\n\n\n"},{"id":"401426","messageId":"20200712230508.GA1000433@isticktoit.net","threadId":"53842","inReplyTo":"xmqqmu44phym.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-07-12T23:05:08Z","receivedAt":"2020-07-12T23:07:24Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"On Sun, Jul 12, 2020 at 02:00:01PM -0700, Junio C Hamano wrote:\n>Sorry, but I am not sure the description is understandable to the\n>intended readers of this sentence.\n>\n>Where does this README.html come from?\n\ngitweb reads a README.html from each repository to display on the \nsummary page. 'man 1 gitweb' has a paragraph on it under \"Per-repository \ngitweb configuration\".\n\n>Is it stored in the history of the repository as a blob, and sent to\n>the browser with a call to git_blob_plain() sub?  Wouldn't that\n\nNo, it's a plain file in a bare repository, placed there either manually \nor by a post-update hook.\n\n>codepath send the untrusted end-user data as an attachment, in which\n>case relative links in the blob do not get resolved relative to the\n>base URL anyway, no?\n\nI'm not exactly sure what you're saying. gitweb includes the README.html \nas-is (i.e. without escaping). If the user wanted to include an image, \nthey'd write <img src=\"blob_plain/HEAD:/image.png\"> (assuming this patch \nlanded). In practise, these URLs will be rewritten by the \nmarkdown-to-html converter.\n"},{"id":"401471","messageId":"xmqqa704owwz.fsf@gitster.c.googlers.com","threadId":"53842","inReplyTo":"20200712230508.GA1000433@isticktoit.net","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-13T04:34:36Z","receivedAt":"2020-07-13T04:34:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tobias Girstmair <tobi@isticktoit.net> writes:\n\n> On Sun, Jul 12, 2020 at 02:00:01PM -0700, Junio C Hamano wrote:\n>>Sorry, but I am not sure the description is understandable to the\n>>intended readers of this sentence.\n>>\n>>Where does this README.html come from?\n>\n> gitweb reads a README.html from each repository to display on the\n> summary page. 'man 1 gitweb' has a paragraph on it under\n> \"Per-repository gitweb configuration\".\n>\n>>Is it stored in the history of the repository as a blob, and sent to\n>>the browser with a call to git_blob_plain() sub?  Wouldn't that\n>\n> No, it's a plain file in a bare repository, placed there either\n> manually or by a post-update hook.\n\nOK.\n\n> ... If the user wanted to\n> include an image, they'd write <img src=\"blob_plain/HEAD:/image.png\">\n> (assuming this patch landed).\n\nAnd without this patch, the src URL needs to know where this\nrepository appears in the site's URL namespace?\n\nIf that is the case, the change makes quite a lot of sense.\n\nThanks.\n\n"},{"id":"401476","messageId":"20200713092928.GA1003518@isticktoit.net","threadId":"53842","inReplyTo":"xmqqa704owwz.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-07-13T09:29:28Z","receivedAt":"2020-07-13T09:29:35Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"On Sun, Jul 12, 2020 at 09:34:36PM -0700, Junio C Hamano wrote:\n>And without this patch, the src URL needs to know where this\n>repository appears in the site's URL namespace?\n\nExactly. Sorry if my lack of proper terminology made this confusing\n\n>If that is the case, the change makes quite a lot of sense.\n>\n>Thanks.\n>\n\n\ttobias\n"},{"id":"401486","messageId":"xmqq1rlfpj8i.fsf@gitster.c.googlers.com","threadId":"53842","inReplyTo":"20200713092928.GA1003518@isticktoit.net","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-07-13T14:44:45Z","receivedAt":"2020-07-13T14:44:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tobias Girstmair <tobi@isticktoit.net> writes:\n\n> On Sun, Jul 12, 2020 at 09:34:36PM -0700, Junio C Hamano wrote:\n>>And without this patch, the src URL needs to know where this\n>>repository appears in the site's URL namespace?\n>\n> Exactly. Sorry if my lack of proper terminology made this confusing\n\nNo, I was confused because I did not know Gitweb showed README.html\nfile in the $GIT_DIR of each repository.  Any other cases that are\naffected by this, or is README the only one?\n\n"},{"id":"401489","messageId":"20200713145931.GA1059578@isticktoit.net","threadId":"53842","inReplyTo":"xmqq1rlfpj8i.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-07-13T14:59:31Z","receivedAt":"2020-07-13T15:15:44Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"On Mon, Jul 13, 2020 at 07:44:45AM -0700, Junio C Hamano wrote:\n>Any other cases that are\n>affected by this, or is README the only one?\n>\n\nREADME.html is the only per-repository file, but gitweb has some \n(unset/nonexisting by default) config variables to include more HTML: \n$site_header, $site_footer, $home_text. These are described in \n'man 5 gitweb.conf' under \"Changing gitweb's look\". grepping for \n'insert_file' reveals them in the code.\n\n\ttobias\n"},{"id":"410423","messageId":"e1b06774-4449-06a2-8c0e-72eabf17b86c@isticktoit.net","threadId":"53842","inReplyTo":"xmqqa704owwz.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v3] gitweb: Replace <base> tag with full URLs (when using PATH_INFO)","fromName":"Tobias Girstmair","fromEmail":"tobi@isticktoit.net","sentAt":"2020-11-20T15:19:48Z","receivedAt":"2020-11-20T15:40:23Z","isPatch":true,"sender":{"key":"tobi@isticktoit.net","avatar":null},"body":"On 13/07/2020 06:34, Junio C Hamano wrote:\n[...]\n> And without this patch, the src URL needs to know where this\n> repository appears in the site's URL namespace?\n> \n> If that is the case, the change makes quite a lot of sense.\n\nHi, this patch probably fell through the cracks. Can it please be \nconsidered for merging again?\n\nAs a reminder, here's a link to the patch:\n   https://lore.kernel.org/git/20200712183329.3358-1-tobi@isticktoit.net/\n\nThanks,\n\ttobias\n"}]}