Skip to content

Commit

Permalink
Also delete parent directory in ZipArchive implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Jan 15, 2022
1 parent ea4542a commit 03592e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/ZipArchive/ZipArchiveAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
use function fopen;
use function rewind;
use function stream_copy_to_stream;
use function stream_with_contents;

final class ZipArchiveAdapter implements FilesystemAdapter
{
Expand Down Expand Up @@ -161,7 +160,7 @@ public function deleteDirectory(string $path): void

$itemPath = $stats['name'];

if ($prefixedPath === $itemPath || strpos($itemPath, $prefixedPath) !== 0) {
if (strpos($itemPath, $prefixedPath) !== 0) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/ZipArchive/ZipArchiveAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function deleting_a_directory(): void
$this->adapter()->deleteDirectory('one');

$items = iterator_to_array($this->adapter()->listContents('', true));
$this->assertCount(4, $items);
$this->assertCount(3, $items);
}

/**
Expand Down

0 comments on commit 03592e7

Please sign in to comment.