Skip to content

Commit 71ef048

Browse files
committed
Add change file
1 parent 2ca2af8 commit 71ef048

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix double slash normalization for `useNavigate` colon urls

‎packages/react-router/__tests__/resolvePath-test.tsx‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,32 @@ describe("resolvePath", () => {
6363
spy.mockRestore();
6464
});
6565

66+
it("handles relative paths with an embedded colon", () => {
67+
expect(resolvePath("foo:bar", "/")).toMatchObject({
68+
pathname: "/foo:bar",
69+
});
70+
71+
expect(resolvePath("./foo:bar", "/")).toMatchObject({
72+
pathname: "/foo:bar",
73+
});
74+
75+
expect(resolvePath("../foo:bar", "/")).toMatchObject({
76+
pathname: "/foo:bar",
77+
});
78+
79+
expect(resolvePath("foo:bar", "/path")).toMatchObject({
80+
pathname: "/path/foo:bar",
81+
});
82+
83+
expect(resolvePath("./foo:bar", "/path")).toMatchObject({
84+
pathname: "/path/foo:bar",
85+
});
86+
87+
expect(resolvePath("../foo:bar", "/path")).toMatchObject({
88+
pathname: "/foo:bar",
89+
});
90+
});
91+
6692
it('ignores trailing slashes on the "from" pathname when resolving relative paths', () => {
6793
expect(resolvePath("../search", "/inbox/")).toMatchObject({
6894
pathname: "/search",

0 commit comments

Comments
 (0)