- $url =~ m!/\z! or $url .= '/';
- $ng_map{$ng} = { url => $url, git_dir => $git_dir };
+ # trailing slash is in the rest of our WWW, so maybe some users
+ # will assume it:
+ if ($parts[-1] eq '') {
+ pop @parts;
+ push @try, join('/', @parts);
+ }
+ my $ALL = $pi_cfg->ALL;
+ if (my $over = $ALL ? $ALL->over : undef) {
+ my $by_eidx_key = $pi_cfg->{-by_eidx_key};
+ for my $mid (@try) {
+ my ($id, $prev);
+ while (my $x = $over->next_by_mid($mid, \$id, \$prev)) {
+ my $xr3 = $over->get_xref3($x->{num});
+ for (@$xr3) {
+ s/:[0-9]+:$x->{blob}\z// or next;
+ my $ibx = $by_eidx_key->{$_} // next;
+ my $url = $ibx->base_url or next;
+ $url .= mid_escape($mid) . '/';
+ return redirect(302, $url);
+ }
+ }
+ }
+ } else { # slow path, scan every inbox
+ for my $mid (@try) {
+ my $arg = [ $mid ]; # [1] => result
+ $pi_cfg->each_inbox(\&try_inbox, $arg);
+ return $arg->[1] if $arg->[1];
+ }