Skip to content

Commit

Permalink
Make sure we don't allow files with wrong extensions
Browse files Browse the repository at this point in the history
The check was on <rakumod pm6 pm> *without* the period, so allowing
files like foo.barakumod
  • Loading branch information
lizmat committed Jul 9, 2020
1 parent 07009cc commit d4eef8d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core.c/CompUnit/Repository/FileSystem.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
has $!distribution;
has $!files-prefix;

my constant @extensions = <rakumod pm6 pm>;
my constant @extensions = <.rakumod .pm6 .pm>;

method !matching-dist(CompUnit::DependencySpecification $spec) {
return $_ with %!seen{~$spec};
Expand Down Expand Up @@ -164,7 +164,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C

# Break the !distribution cache if we failed to find a match using the cached distribution
# but still found an existing file that matches the $spec.short-name
return Empty unless @extensions.map({ $!prefix.add($spec.short-name.subst(:g, "::", $*SPEC.dir-sep) ~ ".$_") }).first(*.f);
return Empty unless @extensions.map({ $!prefix.add($spec.short-name.subst(:g, "::", $*SPEC.dir-sep) ~ $_) }).first(*.f);
$!distribution = Nil;
$distribution = self!distribution;
}
Expand Down

0 comments on commit d4eef8d

Please sign in to comment.