Update LogViewer.php

This commit is contained in:
Jiang Qinghua 2020-07-14 22:45:27 +08:00 committed by GitHub
parent eb0d72ffc8
commit 313a1c5c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -81,19 +81,23 @@ class LogViewer
protected function getRealPath($path)
{
$paths = explode('/', $path);
try {
$paths = explode('/', $path);
$result = '';
foreach ($paths as $v) {
$result .= $v.'/';
$result = '';
foreach ($paths as $v) {
$result .= $v.'/';
$current = rtrim($result, '/');
if (is_link($current)) {
$result = readlink($current).'/';
$current = rtrim($result, '/');
if (is_link($current)) {
$result = readlink($current).'/';
}
}
}
return rtrim($result, '/');
return rtrim($result, '/');
} catch (\Throwable $e) {
return $path;
}
}
protected function formatPath($path)