Skip to content

Commit a67ed38

Browse files
author
Alexis Boissonnat
committed
Fix wrong formatting for URL that ends with /
1 parent dc43850 commit a67ed38

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

tea-cup/src/TeaCup/Navigation.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ const router: Router<MyRoute> = new Router(
9797

9898
expectRoute('/', home());
9999
expectRoute('/songs', songs(nothing));
100+
expectRoute('/songs/', songs(nothing));
100101
expectRoute('/song/123', song(123));
101102
expectRoute('/song/123/edit', song(123, true));
102103
expectRoute('/songs?q=foobar', songs(just('foobar')));

tea-cup/src/TeaCup/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class RouteDef<R> implements RouteBase<R> {
331331

332332
static sanitizePath(path: string): string {
333333
const p1 = path.startsWith('/') ? path.substring(1) : path;
334-
return p1.endsWith('/') ? p1.substring(0, p1.length - 2) : p1;
334+
return p1.endsWith('/') ? p1.substring(0, p1.length - 1) : p1;
335335
}
336336

337337
static splitPath(path: string): ReadonlyArray<string> {

0 commit comments

Comments
 (0)