Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [Unreleased]

### Changed

- Verify if paths are links before there are directories (as a link can represent a directory)

### Fixed

- Deleting a link pointing to a directory now delete the link instead of the directory content

## 4.1.2 - 2026-08-01

### Changed
Expand Down
8 changes: 6 additions & 2 deletions src/Internal/Capabilities/Files/AmbientAuthority.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public function list(Path $path): Sequence
yield Name::of(
$name,
match (true) {
$file->isDir() => Kind::directory,
$file->isLink() => Kind::link,
$file->isDir() => Kind::directory,
default => Kind::file,
},
);
Expand Down Expand Up @@ -117,8 +117,8 @@ public function kind(Path $path): Attempt
}

return Attempt::result(match (true) {
\is_dir($path) => Kind::directory,
\is_link($path) => Kind::link,
\is_dir($path) => Kind::directory,
default => Kind::file,
});
}
Expand Down Expand Up @@ -152,6 +152,10 @@ public function remove(Path $path): Attempt
return Attempt::result(SideEffect::identity);
}

if (\is_link($path->toString())) {
return $this->unlink($path->toString());
}

if ($path->directory() && \is_dir($path->toString())) {
return $this->rmdir($path->toString());
}
Expand Down
Loading