From: Jacob Bachmeyer Date: Thu, 20 Oct 2022 23:17:20 +0000 (-0500) Subject: Add scaffolding for checking "filename" element in read_directive_file X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7152437563b450e3712476af36fe1e0e6a93c6a3;p=gatekeeper.git Add scaffolding for checking "filename" element in read_directive_file --- diff --git a/gatekeeper.pl b/gatekeeper.pl index ed62255..be190c2 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1529,6 +1529,15 @@ sub read_directive_file { my $uploaded_file = shift; my $directive_only = shift; + # scaffolding: will later derive file names from stem + die "directive file name does not match expected pattern" + unless $directive_file =~ m/^(.*)[.]directive[.]asc/; + my $stem = $1; + # The following error is not possible because packets are recognized by + # their stems. This check will be removed later. + die "uploaded file name does not match stem" + unless $directive_only || $uploaded_file eq $stem; + my $directive_file_contents = slurp_directive_file($directive_file); my $directive = read_directive_from_string($directive_file_contents);