mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-09-03 02:42:34 +02:00
Use SplFileInfo::isFile() method for checking if path is a file
This commit is contained in:
@@ -29,11 +29,12 @@ class FileInfoController
|
||||
*/
|
||||
public function __invoke(Response $response, string $path = '.')
|
||||
{
|
||||
if (! is_file($path)) {
|
||||
$file = new SplFileInfo($path);
|
||||
|
||||
if (! $file->isFile()) {
|
||||
return $response->withStatus(404, 'File not found');
|
||||
}
|
||||
|
||||
$file = new SplFileInfo($path);
|
||||
if ($file->getSize() >= $this->config->get('app.max_hash_size', 1000000000)) {
|
||||
return $response->withStatus(500, 'File size too large');
|
||||
}
|
||||
|
Reference in New Issue
Block a user