mirror of
https://github.com/DirectoryLister/DirectoryLister.git
synced 2025-08-24 14:42:53 +02:00
Fixed breadcrumbs not returning crubs for directories with names that exist in the application base_path
This commit is contained in:
@@ -29,7 +29,7 @@ class Breadcrumbs extends ViewFunction
|
||||
/** Build a collection of breadcrumbs for a given path. */
|
||||
public function __invoke(string $path): Collection
|
||||
{
|
||||
return Str::explode($path, $this->directorySeparator)->diff(
|
||||
return Str::explode($path, $this->directorySeparator)->diffAssoc(
|
||||
explode($this->directorySeparator, $this->config->get('base_path'))
|
||||
)->filter(static function (string $crumb): bool {
|
||||
return ! in_array($crumb, [null, '.']);
|
||||
|
@@ -17,7 +17,8 @@ class BreadcrumbsTest extends TestCase
|
||||
'foo' => '?dir=foo',
|
||||
'bar' => '?dir=foo/bar',
|
||||
'baz' => '?dir=foo/bar/baz',
|
||||
]), $breadcrumbs('foo/bar/baz'));
|
||||
'tests' => '?dir=foo/bar/baz/tests',
|
||||
]), $breadcrumbs('foo/bar/baz/tests'));
|
||||
}
|
||||
|
||||
public function test_it_can_parse_breadcrumbs_for_dot_path(): void
|
||||
|
Reference in New Issue
Block a user