Add scaffolding for checking "filename" element in read_directive_file
authorJacob Bachmeyer <jcb@gnu.org>
Thu, 20 Oct 2022 23:17:20 +0000 (18:17 -0500)
committerJacob Bachmeyer <jcb@gnu.org>
Thu, 20 Oct 2022 23:17:20 +0000 (18:17 -0500)
gatekeeper.pl

index ed622558f4c5b836b9cc02616bc944cc50f15eee..be190c26e31180602858e1a56329edbe4674237d 100755 (executable)
@@ -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);