Commit fc0aa9c5 authored by François Agneray's avatar François Agneray
Browse files

Fixed bug file explorer (admin and dataset)

parent e4a2baa8
Pipeline #5139 passed with stages
in 2 minutes and 9 seconds
......@@ -55,24 +55,23 @@ final class AdminFileExplorerAction
return $response->withHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
}
$filePath = $args['fpath'];
$path = $this->dataPath;
if (array_key_exists('fpath', $args)) {
$path .= DIRECTORY_SEPARATOR . $filePath;
$path .= DIRECTORY_SEPARATOR . $args['fpath'];
}
if (is_file($path)) {
throw new HttpBadRequestException(
$request,
'Path ' . $filePath . ' is a file'
'The requested path is a file'
);
}
if (!file_exists($path)) {
throw new HttpNotFoundException(
$request,
'Directory ' . $filePath . ' is not found'
'The requested path is not found'
);
}
......
......@@ -84,24 +84,23 @@ final class DatasetFileExplorerAction extends AbstractAction
$this->verifyDatasetAuthorization($request, $dataset->getName(), $this->settings['admin_role']);
}
$filePath = $args['fpath'];
$path = $this->dataPath . $dataset->getDataPath();
if (array_key_exists('fpath', $args)) {
$path .= DIRECTORY_SEPARATOR . $filePath;
$path .= DIRECTORY_SEPARATOR . $args['fpath'];
}
if (is_file($path)) {
throw new HttpBadRequestException(
$request,
'Path ' . $filePath . ' is a file'
'The requested path is a file'
);
}
if (!file_exists($path)) {
throw new HttpNotFoundException(
$request,
'Directory ' . $filePath . ' is not found'
'The requested path is not found'
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment