Skip to content

Commit 971243e

Browse files
authored
Update LaravelLogViewer.php
1 parent a1cc266 commit 971243e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,16 @@ public static function setFile($file)
7878
*/
7979
public static function pathToLogFile($file)
8080
{
81-
if (!starts_with('/', $file)) {
82-
$logsPath = storage_path('logs');
81+
$logsPath = storage_path('logs');
8382

84-
$file = $logsPath . '/' . $file;
83+
if (app('files')->exists($file)) { // try the absolute path
84+
return $file;
8585
}
86+
87+
$file = $logsPath . '/' . $file;
8688

8789
// check if requested file is really in the logs directory
88-
if (dirname(realpath($file)) !== $logsPath) {
90+
if (dirname($file) !== $logsPath) {
8991
throw new \Exception('No such log file');
9092
}
9193

0 commit comments

Comments
 (0)