Skip to content

Commit df74086

Browse files
committed
fix: simplify symlink check in SymlinkCleaner
1 parent d46eb99 commit df74086

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

src/Service/SymlinkCleaner.php

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

112106
/**
@@ -117,7 +111,8 @@ private function isSymlink(string $path): bool
117111
*/
118112
private function getBasename(string $path): string
119113
{
120-
$trimmed = rtrim($path, '/');
114+
$normalized = str_replace('\\', '/', $path);
115+
$trimmed = rtrim($normalized, '/');
121116
$pos = strrpos($trimmed, '/');
122117
if ($pos === false) {
123118
return $trimmed;

0 commit comments

Comments
 (0)