--- a/lib/CrashTest/Plugin/StackFilter/FileLink.pm Mon Jul 17 22:51:43 2023 +0200
+++ b/lib/CrashTest/Plugin/StackFilter/FileLink.pm Mon Jul 17 22:52:42 2023 +0200
@@ -36,21 +36,36 @@
my ($self, $scm, $repo) = @_;
my $linkconf = "$scm:$repo";
- if(defined($self->{_template_cache}->{$linkconf})) {
+ if(exists($self->{_template_cache}->{$linkconf})) {
return $self->{_template_cache}->{$linkconf};
}
- my $template = $self->config->{WebInterface}->{ScmLinks}->{$linkconf};
+ my $template = $self->config->{WebInterface}->{ScmLinks}->{$linkconf} // undef;
+
+ # try striping repo path elements until a match
+ if(!defined($template)) {
+ my $rpath = $repo;
+ while($rpath =~ m:^(.+)/[^/]+[/]?$:xms) {
+ $rpath = $1;
+ $linkconf = "$scm:$rpath";
+ $template = $self->config->{WebInterface}->{ScmLinks}->{$linkconf} // undef;
+ if(defined($template)) {
+ # keep full repo in cache (avoid loop)
+ $linkconf = "$scm:$repo";
+ break;
+ }
+ }
+ }
# try the generic repository type
if(!defined($template)) {
$linkconf = $scm;
- if(defined($self->{_template_cache}->{$linkconf})) {
+ if(exists($self->{_template_cache}->{$linkconf})) {
return $self->{_template_cache}->{$linkconf};
}
- $template = $self->config->{WebInterface}->{ScmLinks}->{$linkconf};
+ $template = $self->config->{WebInterface}->{ScmLinks}->{$linkconf} // undef;
}
- return undef if !defined($template);
+ return if !defined($template);
$self->app->log->debug("Building template for $linkconf");