This commit is contained in:
jqh 2020-07-13 11:55:39 +08:00
parent 5396f8d6de
commit d65ff46fef

View File

@ -74,11 +74,16 @@ class LogViewer
public function __construct($basePath, $dir, $file = null) public function __construct($basePath, $dir, $file = null)
{ {
$this->basePath = rtrim($basePath, '/'); $this->basePath = rtrim($basePath, '/');
$this->currentDirectory = rtrim($dir, '/'); $this->currentDirectory = $this->formatPath(rtrim($dir, '/'));
$this->file = $file; $this->file = $this->formatPath($file);
$this->files = new Filesystem(); $this->files = new Filesystem();
} }
protected function formatPath($path)
{
return str_replace(['../'], '', $path);
}
/** /**
* Get file path by giving log file name. * Get file path by giving log file name.
* *
@ -103,7 +108,7 @@ class LogViewer
public function setFilename($value) public function setFilename($value)
{ {
$this->filename = $value; $this->filename = $this->formatPath($value);
} }
/** /**