{"thread":{"id":"59192","subject":"[PATCH] gitweb: fix base url set if PATH_INFO is used, add a / at the end.","startedAt":"2023-02-03T21:51:54Z","lastAt":"2023-02-06T22:02:17Z","messageCount":2,"participants":["Daniel Abrecht","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"471462","messageId":"585496b18c853140144c3e7ae13c0124@abrecht.li","threadId":"59192","inReplyTo":null,"subject":"[PATCH] gitweb: fix base url set if PATH_INFO is used, add a / at the end.","fromName":"Daniel Abrecht","fromEmail":"git-git@nodmarc.danielabrecht.ch","sentAt":"2023-02-03T21:42:13Z","receivedAt":"2023-02-03T21:51:54Z","isPatch":true,"sender":{"key":"git-git@nodmarc.danielabrecht.ch","avatar":null},"body":"In HTML, if there is a base tag like `<base href=\"/a/b\">`,\na relative URL like `c/d` will be resolved by the browser as\n`a/c/d` and not as `a/b/c/d`. But with a base tag like\n`<base href=\"/a/b/\">` it will result in `a/b/c/d`. So by\nadding a slash there, the browser should now search the\nfiles at the correct location.\n\nSigned-off-by: Daniel Abrecht <public@danielabrecht.ch>\n---\n  gitweb/gitweb.perl | 2 +-\n  1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex e66eb3d9ba..acb2cce5f6 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -4217,7 +4217,7 @@ sub git_header_html {\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\tprint \"<base href=\\\"\".esc_url($base_url).\"/\\\" />\\n\";\n  \t}\n  \tprint_header_links($status);\n\n-- \n2.39.0\n\n"},{"id":"471614","messageId":"xmqqsffi4fmm.fsf@gitster.g","threadId":"59192","inReplyTo":"585496b18c853140144c3e7ae13c0124@abrecht.li","subject":"Re: [PATCH] gitweb: fix base url set if PATH_INFO is used, add a / at the end.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-02-06T22:02:09Z","receivedAt":"2023-02-06T22:02:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Abrecht <git-git@nodmarc.danielabrecht.ch> writes:\n\n> In HTML, if there is a base tag like `<base href=\"/a/b\">`,\n> a relative URL like `c/d` will be resolved by the browser as\n> `a/c/d` and not as `a/b/c/d`. But with a base tag like\n> `<base href=\"/a/b/\">` it will result in `a/b/c/d`. So by\n> adding a slash there, the browser should now search the\n> files at the correct location.\n>\n> Signed-off-by: Daniel Abrecht <public@danielabrecht.ch>\n> ---\n>  gitweb/gitweb.perl | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index e66eb3d9ba..acb2cce5f6 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -4217,7 +4217,7 @@ sub git_header_html {\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\tprint \"<base href=\\\"\".esc_url($base_url).\"/\\\" />\\n\";\n\nDoesn't this need to be somewhat conditional?  Sites like repo.or.cz\ncurrently give <base href=\"/\" /> presumably because $base_url for\nthem is '/', and this change will make them show double slashes\ninstead of a single one, no?\n"}]}