File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public static function sanitize(string $uri): string
2828 '/<OID> ' ,
2929 '/<NUMBER> ' ,
3030 ],
31- $ uri
31+ ' / ' . ltrim ( $ uri, ' / ' ),
3232 );
3333 }
3434}
Original file line number Diff line number Diff line change @@ -78,4 +78,14 @@ public function testClearUriOids(): void
7878 self ::assertSame ('/v7/test/<OID>/<OID>/<OID> ' , Uri::sanitize ("/v7/test/ {$ oid }/ {$ oid }/ {$ oid }" ));
7979 self ::assertSame ('/v8/test/<OID>/<OID>/<OID>/ ' , Uri::sanitize ("/v8/test/ {$ oid }/ {$ oid }/ {$ oid }/ " ));
8080 }
81+
82+ public function testAddsInitialSlash (): void
83+ {
84+ self ::assertSame ('/v1/ ' , Uri::sanitize ('/v1/ ' ));
85+ self ::assertSame ('/v1 ' , Uri::sanitize ('v1 ' ));
86+ self ::assertSame ('/v1/ ' , Uri::sanitize ('v1/ ' ));
87+ self ::assertSame ('/v1/test/ ' , Uri::sanitize ('/v1/test/ ' ));
88+ self ::assertSame ('/v1/test ' , Uri::sanitize ('v1/test ' ));
89+ self ::assertSame ('/v1/test/ ' , Uri::sanitize ('v1/test/ ' ));
90+ }
8191}
You can’t perform that action at this time.
0 commit comments