From 9848cf8a753ab96969c5ab73c90d871336bffb3d Mon Sep 17 00:00:00 2001 From: Jacob Bachmeyer Date: Wed, 19 Oct 2022 23:32:00 -0500 Subject: [PATCH] Convert "filename_required" flag in read_directive_file to scaffolding Further refactoring will eventually remove it entirely. --- gatekeeper.pl | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/gatekeeper.pl b/gatekeeper.pl index d1969c9..ed62255 100755 --- a/gatekeeper.pl +++ b/gatekeeper.pl @@ -1604,22 +1604,10 @@ sub read_directive_file { } } - # If there is a command in the directive that doesn't require an actual - # file to work on, we won't require the filename line in the directive - # file. This will allow people to upload a directive file only to - # archive/create symlinks/remove symlinks - my $filename_required = 1; - - # There are a few possibilities regarding the 'filename' directive - # 1. It exists in the directive file - there is no problem - # 2. It doesn't exist in the directive file - # In that case, we need to double check a few things. - # This is permitted if the directive file contains commands that - # don't require a filename - currently symlink, rmsymlink, and - # archive - and only the directive file was uploaded - if (!exists($info{filename})) { - $filename_required = 0; - } + # The above check that the directive contains at least one command + # ensures that we either have a filename or do not need one before we + # reach this point. This is temporarily kept as scaffolding. + my $filename_required = exists($info{filename}); if ($filename_required) { # Ben Pfaff wrote: -- 2.25.1