Skip to content

Commit

Permalink
[5.x] Fix additional url segments matching taxonomy terms (#11383)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga authored Jan 23, 2025
1 parent 10ae91c commit 85265e6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Stache/Repositories/TermRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ public function findByUri(string $uri, ?string $site = null): ?Term
return null;
}

if ($term->uri() !== '/'.$uri) {
return null;
}

return $term->collection($collection);
}

Expand Down
8 changes: 8 additions & 0 deletions tests/Data/Taxonomies/ViewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public function it_loads_the_term_url_if_the_view_exists()
$this->get('/tags/test')->assertOk()->assertSeeText('showing Test');
}

#[Test]
public function it_doesnt_load_the_term_url_if_there_are_additional_segments()
{
$this->viewShouldReturnRaw('tags.show', 'showing {{ title }}');

$this->get('/tags/test/extra/segments')->assertNotFound();
}

#[Test]
public function it_loads_the_localized_term_url_if_the_view_exists()
{
Expand Down

0 comments on commit 85265e6

Please sign in to comment.