Update LogViewer.php

This commit is contained in:
Jiang Qinghua 2020-07-10 12:21:11 +08:00 committed by GitHub
parent 179bca3f8c
commit a59d1eb588
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,8 +73,8 @@ class LogViewer
*/
public function __construct($basePath, $dir, $file = null)
{
$this->basePath = trim($basePath, '/');
$this->currentDirectory = trim($dir, '/');
$this->basePath = rtrim($basePath, '/');
$this->currentDirectory = rtrim($dir, '/');
$this->file = $file;
$this->files = new Filesystem();
}
@ -192,7 +192,7 @@ class LogViewer
public function isCurrentFile($file)
{
return $this->replaceBasePath($this->getFilePath()) === trim($this->currentDirectory.'/'.$file, '/');
return $this->replaceBasePath($this->getFilePath()) === rtrim($this->currentDirectory.'/'.$file, '/');
}
/**