Skip to content

Commit 5f15c5a

Browse files
committed
-
Signed-off-by: azjezz <azjezz@protonmail.com>
1 parent af65f04 commit 5f15c5a

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/Resolver/PrefixMatchingResolver.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use HackRouting\HttpException\NotFoundException;
88
use HackRouting\PrefixMatching\PrefixMap;
9+
910
use function array_merge;
1011
use function is_string;
1112
use function preg_match;
@@ -87,12 +88,14 @@ private static function resolveWithMap($path, $map)
8788
}
8889

8990
if ($prefixes = $map->prefixes) {
90-
$prefix = substr($path, 0, $map->getPrefixLength());
91+
$prefix = substr($path, 0, $map->prefixLength);
9192
if (isset($prefixes[$prefix])) {
92-
return self::resolveWithMap(
93-
substr($path, $map->prefixLength),
94-
$prefixes[$prefix],
95-
);
93+
$path = substr($path, $map->prefixLength);
94+
if ($path === '') {
95+
throw new NotFoundException();
96+
}
97+
98+
return self::resolveWithMap($path, $prefixes[$prefix]);
9699
}
97100
}
98101

0 commit comments

Comments
 (0)