Skip to content

Commit

Permalink
🩹 wrap possible symlink in realpath(). (#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
oskar-koli authored and QWp6t committed Jan 25, 2024
1 parent e4a134d commit 4b5caa4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Roots/Acorn/Sage/ViewFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(FileViewFinder $finder, Filesystem $files, $path = '
{
$this->finder = $finder;
$this->files = $files;
$this->path = realpath($path ? $path : get_theme_file_path());
$this->path = realpath($path ?: get_theme_file_path());
}

/**
Expand All @@ -55,9 +55,10 @@ public function locate($file)
}

return $this->getRelativeViewPaths()
->flatMap(fn ($viewPath) => collect($this->finder->getPossibleViewFilesFromPath($file))
->merge([$file])
->map(fn ($file) => "{$viewPath}/{$file}")
->flatMap(
fn ($viewPath) => collect($this->finder->getPossibleViewFilesFromPath($file))
->merge([$file])
->map(fn ($file) => "{$viewPath}/{$file}")
)
->unique()
->map(fn ($file) => trim($file, '\\/'))
Expand Down

0 comments on commit 4b5caa4

Please sign in to comment.