Skip to content

Commit 26ff238

Browse files
authored
block restricted file and clean up (#46)
Signed-off-by: rahul <rcsofttech85@gmail.com>
1 parent 6ccf1db commit 26ff238

File tree

9 files changed

+1439
-1396
lines changed

9 files changed

+1439
-1396
lines changed

bin/view-csv

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,24 @@ $command = (new SingleCommandApplication())
2626
$limit = $input->getOption('limit');
2727

2828
try {
29-
$csvFile = (new class {
29+
$filValidator = (new class {
3030
use FileValidatorTrait;
31-
})->validateFileName($csvFile);
31+
});
32+
if ($filValidator->isFileRestricted($csvFile, 'STORED_HASH_FILE')) {
33+
throw new FileHandlerException();
34+
}
35+
$csvFile = $filValidator->validateFileName($csvFile);
3236
} catch (FileHandlerException) {
33-
$io->error("{$csvFile} does not exists");
37+
$io->error(
38+
"{$csvFile} does not exists"
39+
);
3440
return Command::FAILURE;
3541
}
3642

3743
if (isset($limit) && !is_numeric($limit)) {
38-
$io->error("{$limit} is not numeric");
44+
$io->error(
45+
"{$limit} is not numeric"
46+
);
3947
return Command::FAILURE;
4048
}
4149

0 commit comments

Comments
 (0)