From 0214553385434bda97e9f2c2019545b83051916b Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sun, 16 Aug 2026 15:32:08 +0200 Subject: [PATCH] fix removing broken links --- CHANGELOG.md | 1 + src/Internal/Capabilities/Files/AmbientAuthority.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be5aa0b..4265895 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Flagging a stream as blocking was set as non-blocking - Timeout periods above the minute were not taking into account - Socket client options are applied when connecting, not after +- Broken links couldn't be removed ## 4.1.2 - 2026-08-01 diff --git a/src/Internal/Capabilities/Files/AmbientAuthority.php b/src/Internal/Capabilities/Files/AmbientAuthority.php index 6824a94..dfce833 100644 --- a/src/Internal/Capabilities/Files/AmbientAuthority.php +++ b/src/Internal/Capabilities/Files/AmbientAuthority.php @@ -148,14 +148,14 @@ public function create(Path $path): Attempt #[\Override] public function remove(Path $path): Attempt { - if (!\file_exists($path->toString())) { - return Attempt::result(SideEffect::identity); - } - if (\is_link($path->toString())) { return $this->unlink($path->toString()); } + if (!\file_exists($path->toString())) { + return Attempt::result(SideEffect::identity); + } + if ($path->directory() && \is_dir($path->toString())) { return $this->rmdir($path->toString()); }