about summary refs log tree commit homepage
path: root/lib/PublicInbox/Git.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-04 10:34:03 +0000
committerEric Wong <e@80x24.org>2023-01-05 09:58:27 +0000
commita0646591eacd2403476545ac4569bd7c551e67cf (patch)
treedfe4218c943d3b6cef7ba8bb7f1edba2ddca47eb /lib/PublicInbox/Git.pm
parent7ea6eb5a69ae3e58d49eb1b04bd015d7eb38695f (diff)
downloadpublic-inbox-a0646591eacd2403476545ac4569bd7c551e67cf.tar.gz
When using the `mount' directive in PSGI (Plack::App::URLMap),
SCRIPT_NAME still needs to use a trailing slash before it can
be joined with another URL.
Diffstat (limited to 'lib/PublicInbox/Git.pm')
-rw-r--r--lib/PublicInbox/Git.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm
index c7f82ba2..d8468b4f 100644
--- a/lib/PublicInbox/Git.pm
+++ b/lib/PublicInbox/Git.pm
@@ -477,10 +477,10 @@ sub local_nick ($) {
 sub host_prefix_url ($$) {
         my ($env, $url) = @_;
         return $url if index($url, '//') >= 0;
-        my $scheme = $env->{'psgi.url_scheme'};
         my $host_port = $env->{HTTP_HOST} //
                 "$env->{SERVER_NAME}:$env->{SERVER_PORT}";
-        "$scheme://$host_port". ($env->{SCRIPT_NAME} || '/') . $url;
+        my $sn = $env->{SCRIPT_NAME} // '';
+        "$env->{'psgi.url_scheme'}://$host_port$sn/$url";
 }
 
 sub base_url { # for coderepos, PSGI-only