Skip to content

Commit

Permalink
[4.x] Harden collection handle check in Taxonomy::findByUri to preven…
Browse files Browse the repository at this point in the history
…t partial matches (#9108)
  • Loading branch information
ryanmitchell authored Dec 4, 2023
1 parent fce823a commit 1466720
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Stache/Repositories/TaxonomyRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function findByUri(string $uri, string $site = null): ?Taxonomy
return true;
}

return Str::startsWith($uri, '/'.$collection->handle());
return Str::startsWith($uri.'/', '/'.$collection->handle().'/');
});

if ($collection) {
Expand Down
2 changes: 1 addition & 1 deletion src/Stache/Repositories/TermRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function findByUri(string $uri, string $site = null): ?Term
return true;
}

return Str::startsWith($uri, '/'.$collection->handle());
return Str::startsWith($uri.'/', '/'.$collection->handle().'/');
});

if ($collection) {
Expand Down

0 comments on commit 1466720

Please sign in to comment.