Skip to content

Commit bdb9c28

Browse files
committed
fix: improve symlink check using file stat
1 parent 107941d commit bdb9c28

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Service/SymlinkCleaner.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ public function cleanSymlinks(
100100
*/
101101
private function isSymlink(string $path): bool
102102
{
103-
return is_link($path);
103+
try {
104+
$stat = $this->fileDriver->stat($path);
105+
} catch (\Exception $e) {
106+
return false;
107+
}
108+
109+
return (($stat['mode'] ?? 0) & 0120000) === 0120000;
104110
}
105111

106112
/**

0 commit comments

Comments
 (0)