Hydra/Controller/Root: remove deprecated LocalRegex

11:38:20 hydra-server.1       | DEPRECATION WARNING: The Regex dispatch type is deprecated.
11:38:20 hydra-server.1       |   It is recommended that you convert Regex and LocalRegex
11:38:20 hydra-server.1       |   methods to Chained methods. at /nix/store/aa6gw57fnahd4824pbhmvcs0jlypmynq-hydra-perl-deps/lib/perl5/site_perl/5.32.1/Catalyst/DispatchType/Regex.pm line 210.
This commit is contained in:
Cole Helbling 2021-11-30 12:37:17 -08:00
parent ecb1454cf1
commit 5659d2982c
2 changed files with 7 additions and 5 deletions

View file

@ -429,7 +429,6 @@
CatalystAuthenticationStoreDBIxClass
CatalystAuthenticationStoreLDAP
CatalystDevel
CatalystDispatchTypeRegex
CatalystPluginAccessLog
CatalystPluginAuthorizationRoles
CatalystPluginCaptcha

View file

@ -15,6 +15,9 @@ use JSON;
use List::Util qw[min max];
use List::MoreUtils qw{any};
use Net::Prometheus;
use Types::Standard qw/StrMatch/;
use constant NARINFO_REGEX => qr{^([a-z0-9]{32})\.narinfo$};
# Put this controller at top-level.
__PACKAGE__->config->{namespace} = '';
@ -349,17 +352,17 @@ sub nix_cache_info :Path('nix-cache-info') :Args(0) {
}
sub narinfo :LocalRegex('^([a-z0-9]+).narinfo$') :Args(0) {
my ($self, $c) = @_;
sub narinfo :Path :Args(StrMatch[NARINFO_REGEX]) {
my ($self, $c, $narinfo) = @_;
if (!isLocalStore) {
notFound($c, "There is no binary cache here.");
}
else {
my $hash = $c->req->captures->[0];
my ($hash) = $narinfo =~ NARINFO_REGEX;
die if length($hash) != 32;
die("Hash length was not 32") if length($hash) != 32;
my $path = queryPathFromHashPart($hash);
if (!$path) {