Skip to content

Commit 4ba719a

Browse files
committed
fix(Router): ignore blacklist paths of external link
Closes PERMISSION-832
1 parent 3f7bc23 commit 4ba719a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/runtime/src/internal/Router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class Router {
331331
path = path.replace(/^\/next\//, "/");
332332
}
333333

334-
path && hooks?.auth?.addPathToBlackList?.(path);
334+
path && path.startsWith("/") && hooks?.auth?.addPathToBlackList?.(path);
335335
});
336336
blocked = hooks?.auth?.isBlockedPath?.(location.pathname);
337337
}

packages/runtime/src/internal/Runtime.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,6 +1789,9 @@ HTMLCollection [
17891789
{
17901790
url: "/next/blocked-app/blocked-path-2",
17911791
},
1792+
{
1793+
url: "http://aaa.com",
1794+
},
17921795
{
17931796
to: {} as unknown as string,
17941797
},
@@ -1813,6 +1816,7 @@ HTMLCollection [
18131816
expect(addPathToBlackList).toHaveBeenCalledWith(
18141817
"/blocked-app/blocked-path-2"
18151818
);
1819+
expect(addPathToBlackList).not.toHaveBeenCalledWith("http://aaa.com");
18161820
});
18171821

18181822
test("failed to bootstrap", async () => {

0 commit comments

Comments
 (0)